|Perl Monk, Perl Meditation|
Re: How to express contents of a file as regex metachars?by jwkrahn (Monsignor)
|on Jun 16, 2012 at 05:54 UTC||Need Help??|
Your use of [\d\w] is redundant because the \w character class also includes the same characters of the \d character class. Also, the \w character class includes the _ character (underscore) which is not an alphanumeric character. You should just use [A-Za-z0-9] which only matches alphanumeric characters.
You don't have to capture the match and get its length, you can just pass its length directly: