Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^3: Regular expression * vs +

by mwah (Hermit)
on May 20, 2008 at 13:22 UTC ( [id://687603]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Regular expression * vs +
in thread Regular expression * vs +

I think the OP struggled over the difference between

... my $txt='-UK 123 123-UK 123-UK 123-UK'; print "|$1| - match until pos:" . pos($txt) . "\n" while $txt=~/((?:\ +d+-UK\W?)+)/g ; ...

and

... my $txt='-UK 123 123-UK 123-UK 123-UK'; print "|$1| - match until pos:" . pos($txt) . "\n" while $txt=~/((?:\ +d+-UK\W?)*)/g ; ...

which is the difference between (expr)+ and (expr)*, the latter matching everywhere and (of course) at 'expr', the former matching only at 'expr'.

(maybe I misinterpreted his intention)

Regards

mwa

Log In?
Username:
Password:

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

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

    No recent polls found