Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Regular expressions to store matching patterns in an array.

by ketema (Scribe)
on Jun 22, 2005 at 20:58 UTC ( [id://469179]=note: print w/replies, xml ) Need Help??


in reply to Regular expressions to store matching patterns in an array.
in thread How can I place each "word" of a string in a varible if I don't know the length of the string?

Is it possible to do the opposite? Make an assignment of one scalar if a match is found in the elements of an array? I'm sure this syntax is wrong, but something like:
@terms = ("Word1","Word2","Word3"); $match = $1 if($lineFromSomeTextFile =~ /(^@terms)/);
I know the regular expression part is wrong, but is there some advanced Monk way of accomplishing this? What about grep? can that somehow be incorporated into the regex?

Replies are listed 'Best First'.
Re^2: Regular expressions to store matching patterns in an array.
by planetscape (Chancellor) on Jun 23, 2005 at 18:21 UTC

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-16 04:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found