in reply to RE: (tye)Re: Regular expression to match an A=B type string needs help in storing matched parts of string
in thread Regular expression to match an A=B type string needs help in storing matched parts of string

Well, I was thinking of the string after the "=" being long, but the greedy version still wins. Perhaps the regex works from the back even when non-greedy?

My (incorrect, apparently) thinking was that /[^=]+=/ will have to check the whole string to make sure there isn't a second "=" later on while /[^=]+?=/ could just stop at the first "=" (provided the rest of the regex matched). I'd be interested in any insights on this. [ Didn't I make this exact same mental error before... I'll have to go check and then double check the read-only tab on my brain ]

        - tye (but my friends call me "Tye")
  • Comment on RE: RE: (tye)Re: Regular expression to match an A=B type string needs help in storing matched parts of string
  • Select or Download Code

Replies are listed 'Best First'.
RE: RE: RE: (tye)Re: Regular expression to match an A=B type string needs help in storing matched parts of string
by japhy (Canon) on Sep 21, 2000 at 22:28 UTC
    In the regex /[^=]+=/, the [^=] part matches NON-= characters. The = then matches an = sign after the non-= characters. That's basically all I can think to say...

    $_="goto+F.print+chop;\n=yhpaj";F1:eval