The regex compiler doesn't like the extra whitespace within the .{0, 5} expression.
>perl -wMstrict -le "use v5.14; use warnings; ;; while (<>) { chomp; if (m/(?<WORD>\b\w*a\b)(?<EXTRA>.{0,5})/) { say qq{Word contains '$+{WORD}'}; say qq{Extra characters after Word are '$+{EXTRA}'}; } else { say qq{No Match: |$_|}; } } " I saw Wilma yesterday Word contains 'Wilma' Extra characters after Word are ' yest' ^Z
In reply to Re: Why this Regex code is not working??
by AnomalousMonk
in thread Why this Regex code is not working??
by Rohit Jain
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |