Then the length of the regexs won't be an issue.my $pattern1 = qr{abc:\(?.*?\)?\s}; my $pattern2 = qr{${variable}.{0,5}\s}; if ($str =~ /$pattern1(.*?)$pattern2/) { print "matched $1"; } if ($str =~ /$pattern2(.*?)$pattern1/) { print "matched $1"; }
In reply to Re: Regex match at the beginning or end of string
by wind
in thread Regex match at the beginning or end of string
by cyber-guard
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |