|laziness, impatience, and hubris|
Re^2: Character Class Abbreviationsby planetscape (Chancellor)
|on Dec 24, 2005 at 00:19 UTC||Need Help??|
In replying to a 6-yr old node, your question is in danger of flying beneath everyone's radar. Better to post under Seekers of Perl Wisdom. To get an idea of how this site works, I recommend looking at the "Welcome to the Monastery" section of the Tutorials page.
You might wish to check out some of the references listed here: Re: regexp: extracting info
In your example, it sounds to me more like you are trying to match the literal string "en". But let's assume for a moment you really want a character class...
One of the tools I didn't mention in the writeup above is the simple "patten test" program from Learning Perl, 3rd Ed. I often use this when first constructing a regex because it's simple, easy to edit, and I get immediate feedback. So let's start with that program, modified slightly to match the character class [en] .
Let's assume that this is our "test" file:
Where and how the character class matches may surprise you:
If you were expecting output more like the following, matching the string "en":
You will need to change the program as follows: