Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: lookahead / lookbehind vs other regex methods

by BrowserUk (Patriarch)
on Jan 07, 2004 at 22:13 UTC ( [id://319625]=note: print w/replies, xml ) Need Help??


in reply to lookahead / lookbehind vs other regex methods

Avoiding capturing is one of the keys to writing quicker regexes. Using (?:...) rather than (...) when you don't need the capture can make a substantial difference to the speed at which they run, especially if the regex does a lot of backtracking; which is another thing to avoid where possible.

So using zero-length assertions instead of captures probably has the same benefits. It also makes the purpose of the regex less obscure IMO.

Note: This is just based my personal experiences of using the re, rather than any insight into the workings of the re.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
Hooray!

  • Comment on Re: lookahead / lookbehind vs other regex methods

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2024-04-18 13:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found