I am doing pattern match for some names below:
ABCD123_HH1
ABCD123_HH1_K
Now, my code to grep above names is below:
($name, $kind) = $dirname =~ /ABCD(\d+)\w*_([\w\d]+)/;
Now, problem I am facing is that I get both the patterns that is ABCD123_HH1
, ABCD123_HH1_K
in $dirname
. However, my variable $kind
doesn't take this ABCD123_HH1_K
. It does take ABCD123_HH1
pattern.
Appreciate your time. Could you please tell me what can be done to get pattern with _k
.