Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: Regarding Regular Expressions

by pbeckingham (Parson)
on Aug 17, 2004 at 13:15 UTC ( [id://383652]=note: print w/replies, xml ) Need Help??


in reply to Re: Regarding Regular Expressions
in thread Regarding Regular Expressions

Solutions involving substitution are not what the OP wants. How about this:

my @results = $mystr =~ /(efg)/g;
Taken literally, "e followed by fg" is efg. If other characters may come between, try:
my @results = $mystr =~ /(e.*?fg)/g;



pbeckingham - typist, perishable vertebrate.

Replies are listed 'Best First'.
Re^3: Regarding Regular Expressions
by borisz (Canon) on Aug 17, 2004 at 13:28 UTC
    Thats wrong, since the example has more 'fg' as 'e' so every hit starts at the first e and ends at x's 'fg'.
    $input = 'xxxxefghijklfghijklabcdefg'; __OUTPUT__ efg efghijklfg efghijklfghijklabcdefg
    Boris

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-03-29 07:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found