Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Re: Strip user-defined words with regexp

by Marcello (Hermit)
on Mar 04, 2004 at 14:41 UTC ( #333872=note: print w/replies, xml ) Need Help??


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"; }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://333872]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (7)
As of 2020-05-31 22:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (177 votes). Check out past polls.

    Notices?