# Remove leading and trailing whitespace. $str =~ s{\A \* | \s* \z}{}gxm;
That doesn't actually remove leading whitespace, it removes a leading * character. You probably want s{\A \s+ | \s+ \z}{}gx instead.
if ($str =~ /nbk[A-z0-9]{4}/ or /nbd[A-z0-9]{4}/ or /root/){
The character class [A-z0-9] also matches the characters [ \ ] ^ _ ` Did you intend to include those characters or did you really mean to use [A-Za-z0-9]?
In reply to Re: Not matching REGEX
by jwkrahn
in thread Not matching REGEX
by cutter
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |