Perl Monk, Perl Meditation | |
PerlMonks |
Re: Extracting Strings - Special Casesby Athanasius (Archbishop) |
on Jan 07, 2013 at 13:35 UTC ( [id://1012032]=note: print w/replies, xml ) | Need Help?? |
Hello rajkk04, and welcome to the Monastery! i want to extract only 4 letters (alphanumeric) in the complete text. Assuming this means: Match the first alphanumeric word of exactly 4 characters appearing between double quotes:
Output:
See “Quantifiers” under perlre#Regular-Expressions. Update: If you need to match strictly alphanumeric characters only (no punctuation characters), change \w in the regex to [A-Za-z0-9]. Hope that helps,
In Section
Seekers of Perl Wisdom
|
|