Perl-Sensitive Sunglasses | |
PerlMonks |
Re: Regex matchingby bronto (Priest) |
on Jul 03, 2002 at 12:28 UTC ( [id://179134]=note: print w/replies, xml ) | Need Help?? |
Fast and simple solution:
If the line you have in $text begins with "UFOFH ", it wipes it away and splits on spaces. Cheers! Update: pure regexp solution:
Update II:typo: you don't need the i when you are not matching alphabetics Using the conditional if beginning of string matches... then match... should improve greatly the speed of the matching, compared to your solution. In fact, you are matching your pattern anywhere in the string, and that's expensive. The tecnique I used matches a short string at a specified position (the beginning of the line), and that's really fast! And if it doesn't match you don't waste your time trying to match your pattern against a string you are not interested in. Anybody guessed I am in a hurry? :-)
In Section
Seekers of Perl Wisdom
|
|