Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Combinatorial regexing

by blokhead (Monsignor)
on May 04, 2007 at 18:36 UTC ( [id://613632]=note: print w/replies, xml ) Need Help??


in reply to Combinatorial regexing

Try something like this:
while ($string =~ / (?=([a-z]+[ ][a-z]+)) [a-z]+ /gx) {
This says: look ahead to capture the next two words, without advancing pos. Then with that stuff captured, advance pos as far as the first word. However, I don't see much wrong with using @words like you've done in your last example...

blokhead

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-04-18 01:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found