Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re^2: Regex problem - (non)greedy?

by ikegami (Pope)
on Nov 14, 2013 at 14:31 UTC ( #1062594=note: print w/replies, xml ) Need Help??

in reply to Re: Regex problem - (non)greedy?
in thread Regex problem - (non)greedy?

I expect that doesn't give the intended results for any of the following:

"cdghi" "cd ghi ghi"

Furthermore, that pattern won't help if we wants to go on to handle either of the following:

"cd XXX ghi cd YYY ghi" "cd XXX cd YYY ghi ZZZ ghi"

By the way, you really want to add a leading ^ to that to speed things up greatly when the pattern doesn't match.

Replies are listed 'Best First'.
Re^3: Regex problem - (non)greedy?
by hdb (Prior) on Nov 14, 2013 at 14:34 UTC

    I am not sure what the expected results are, but the actual results are:

    cdghi: (no match) cd ghi ghi: ghi cd abc ghi cd def ghi: def
      I expect he'd want "" for the first and "" for the second. As for the third, see my update.

        The first one does not match as the OP contains two spaces at least between 'cd' and 'ghi'.

        Also what would he expect for 'cd cd ghi'?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1062594]
[choroba]: last ambrus: 1 week ago :-(
[erix]: let's invade Hungary
[planetscape]: darn
[erix]: probably on holiday, the slacker
erix is reduced to use a BROWSER. (remember those?)
[Discipulus]: figuring.. i'm still just use the side pm chat..
[erix]: (all this while karls guitar gently weeps...)
[planetscape]: (invade Hungary)++ #I'm hungry
[stonecolddevin]: i went too far down the irc rabbithole to hook this back up there
[Discipulus]: .. yes erix until NodeReaper put jhon coltrane again

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (8)
As of 2017-06-22 21:11 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (531 votes). Check out past polls.