Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^5: Help with Double Double Quotes regular expression (failing)

by pKai (Priest)
on Apr 02, 2007 at 22:23 UTC ( [id://607935]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Help with Double Double Quotes regular expression (imprecise)
in thread Help with Double Double Quotes regular expression

I noticed that your sample $s is a non-matching one.

Did you take that on purpose to emphasise on cutting off backtracking in the failing case?

When I balance the (double)quotes in $s by adding one in last position (directly before the closing parentheses of q,) "straight" seems to have a slight edge over "cut"

Rate cut straight cut 110876/s -- -13% straight 127147/s 15% --
I got similar figures as you for your original $s

Replies are listed 'Best First'.
Re^6: Help with Double Double Quotes regular expression (failing)
by bart (Canon) on Apr 02, 2007 at 22:28 UTC
    I noticed that your sample $s is a non-matching one.

    Did you take that on purpose to emphasise on cutting off backtracking in the failing case?

    I did. Because it's a well known fact (see the owl book AKA Jeffrey Friedl's "Mastering Regular Expressions", for example) that the pathetic case typically rears its ugly head when matches fail. That was the case in my Javascript code, too.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2024-04-25 06:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found