Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Regex help

by GrandFather (Sage)
on Sep 10, 2012 at 04:00 UTC ( #992660=note: print w/replies, xml ) Need Help??


in reply to Regex help

+ is greedy and will match as many of whatever it applies to as it can. Generally it is smart to avoid . and use an explicit set of characters to match. In this case everything except / looks like it may be what you want:

$str =~ m!(.+)(/path/)([^/]+)(/.+)!

Note that I used ! as the regex delimiter to avoid having to quote all the / characters.

True laziness is hard work

Replies are listed 'Best First'.
Re^2: Regex help
by yoda54 (Monk) on Sep 10, 2012 at 04:06 UTC
    Thank you sir! :-D

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://992660]
help
Chatterbox?
thezip switches the jolokia powder with Folgers Crystals...
[Michael W]: So i can read ok from this how do i put data back inmy @Variables = ( $Map_Request_Date, $Map_Due_Date,$Map _Cutover_Date,$Map _Complete_Date,$Ma p_Approved_Date);
[Corion]: Michael_W: $Variables[0] = $Map_Request_Date; $Variables[1] = $Map_Due_Date; ...
[choroba]: ( $Map_Request_Date, $Map_Due_Date,$Map _Cutover_Date,$Map _Complete_Date,$Ma p_Approved_Date) = @Variables;?

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (11)
As of 2017-04-27 15:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (509 votes). Check out past polls.