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

Re: Re: Yet another regex bug.

by hossman (Prior)
on Nov 12, 2002 at 03:11 UTC ( #212183=note: print w/ replies, xml ) Need Help??


in reply to Re: Yet another regex bug.
in thread Yet another regex bug.

That implies that "removing the comment" is the translation...

/abc(?#comment)+/  ----> /abc(?#comment)+/ /abc+/

Where as I (and evidently at least 2 other people) expect it to be the translation...

/abc(?#comment)+/  ------> /abc()+/

Updated: forgot to acctually make the translation i was trying to show.


Comment on Re: Re: Yet another regex bug.
Re (3): Yet another regex bug.
by VSarkiss (Monsignor) on Nov 12, 2002 at 03:33 UTC

    Well, your first line is the identity transformation, which isn't removing anything. ;-)

    The parentheses surrounding the ?# are part of the syntax; that is, the comment marker in a regexp begins (?#, not ?#. (Check perlre: all the "funny" extended-pattern elements start with (?, one of the reasons being that it's a mnemonic to "question" what's coming next.1) Thus if you're removing the comment you should remove the parentheses as well.

    1I don't buy the explanation, by the way, but it's there..

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://212183]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2014-12-28 11:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (180 votes), past polls