Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^3: Regular expression * vs +

by mwah (Hermit)
on May 20, 2008 at 13:22 UTC ( #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
Node Status?
node history
Node Type: note [id://687603]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2021-04-23 08:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?