|Think about Loose Coupling|
Strip user-defined words with regexpby Marcello (Hermit)
|on Mar 04, 2004 at 14:25 UTC||Need Help??|
Marcello has asked for the wisdom of the Perl Monks concerning the following question:
I am looking for a way to get the first two words of a sentence. A word is defined as [A-Za-z0-9]+
The regexp must be able to handle arbitrary sentences, including newlines, \0, \t etc etc.
I currently use this regexp, but I am sure there is an easier one:
Update: The term phrase is probably better, I want to extract the first two words of a phrase (user input, so contains probably every possible character :) ), no matter how many lines/sentences this input is.