Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: One line assigment statement with regex match

by planetscape (Chancellor)
on Jun 23, 2005 at 18:05 UTC ( [id://469476]=note: print w/replies, xml ) Need Help??


in reply to Re: One line assigment statement with regex match
in thread One line assigment statement with regex match

Just because I really like grinder's Regexp::Assemble, and think such a cool module needs more exposure:

#!/usr/bin/perl -w use Regexp::Assemble; my $lineFromSomeTextFile = "your line right here\n"; my $ra = Regexp::Assemble->new->add( "something", "matching", "a", "line" ); print $ra->re . "\n"; # because the output is cool # and sometimes educational my($word) = $lineFromSomeTextFile =~ /($ra)/; print "found '$word' in: $lineFromSomeTextFile";

(For more on Regexp::Assemble see: Why machine-generated solutions will never cease to amaze me.)

HTH,

planetscape

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2024-03-28 23:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found