Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: regular expression not matchingby igelkott (Priest) |
on Mar 13, 2013 at 07:46 UTC ( [id://1023135]=note: print w/replies, xml ) | Need Help?? |
I understand that you posted the wrong code but a small change in the original will work as (apparently) intended. Specifically, the first '+' should be moved outside the square brackets since "\w", "_", "-" are all in the set you're looking for. In other words, change ([\w+\_\-]) to ([\w\_\-]+). Better yet, since "_" is included in "\w" and "-" doesn't need to be escaped if it's first or last, you can simplify this to ([\w-]+).
In Section
Seekers of Perl Wisdom
|
|