in reply to Re: Strip user-defined words with regexp
in thread Strip user-defined words with regexp

I knew somebody was going to say this...

It's not, I have an application which has to determine by the first two words of a phrase what todo. This phrase can be anything, it might even be only one word. Examples:

my $message = "test one"; my $message = "test"; my $message = "_$ test..."; my $message = "_$ TEST..1.."; my $message = "_$\nTEST1.\n.1.2.3";
BTW: \w is not helping me here, since I do not want the underscore character.

Replies are listed 'Best First'.
Re: Re: Re: Strip user-defined words with regexp
by Happy-the-monk (Canon) on Mar 04, 2004 at 14:54 UTC
    Limbic~Region has almost got it then:
    if ( $message =~ /([a-zA-Z0-9]+)[^a-zA-Z0-9]*([a-zA-Z0-9]*)/ ) { print "$1 $2\n"; }