Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1062594]
help
Chatterbox?
[Corion]: Hi marto :)
[Discipulus]: morning marto!
[Corion]: Hmmm - I would have assumed that << is not special in cmd.exe, but maybe it is ...
[karlgoethebier]: Discipulus: Corion may be right... backslash?
[karlgoethebier]: Discipulus: i don't know. no msdog at hand no more
[Eily]: Discipulus I get the same thing on strawberry perl v5.20

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (9)
As of 2017-07-21 08:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (319 votes). Check out past polls.