"Maximally one underscore", like "maximally n anything", is easiest done adding a negative lookahead after the start anchor:
/^(?!.*_.*_)\w*[A-Za-z]\w*$/
(That is also the most readable way, IMO, and not too slow, though if execution speed is an issue, doing it as a single regex is probably wrong anyway.)
print "Just another Perl ${\(trickster and hacker)},"
The Sidhekin proves Sidhe did it!
In reply to Re: A single regex
by Sidhekin
in thread A single regex
by kiat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |