![]() |
|
more useful options | |
PerlMonks |
Re^3: Looking for a regular expression for the following pattern.by Anonymous Monk |
on Mar 30, 2018 at 02:22 UTC ( #1212013=note: print w/replies, xml ) | Need Help?? |
The first two requirements sound like the same thing: /([:alnum:]+[_]+/. But the third requirement is a subset of the first, consuming the alnum sequence with no need for underscore. Two regexes joined by || logical-or would do it. However, it just might be as simple as replacing the last + in the above regex with * to indicate "zero or more" underscores. The pattern now looks for one-or-more alnum characters followed by zero-or-more underscores.
In Section
Seekers of Perl Wisdom
|
|