Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: alternation in regexes: to use or to avoid?

by balker (Novice)
on Dec 10, 2012 at 15:51 UTC ( [id://1008126]=note: print w/replies, xml ) Need Help??


in reply to Re: alternation in regexes: to use or to avoid?
in thread alternation in regexes: to use or to avoid?

(I work with dk.)

Another question could be: why is the one with the capture groups so slow, since none of the words match the string?

And in general, why is alternation&capture so much slower than looping&capture + alternation combined?

The reason for the code is to replace code with 60 or so similarly structured regexes in a library used by a couple of legacy applications with an automatically generated regex generated with info from configuration files, for both (potential) performance gains, allowing different behaviour across applications, and definite maintainability gains. The strings replaced all have the structure \bFOO:\s*bar(\d+) or \bBAZ:\s*(\w+) etc.

Suggestions like "Well, don't do that" are likely to go unheard :-)

  • Comment on Re^2: alternation in regexes: to use or to avoid?

Replies are listed 'Best First'.
Re^3: alternation in regexes: to use or to avoid?
by RichardK (Parson) on Dec 10, 2012 at 16:08 UTC

    OK then, If you want to use a non-optimal solution for operational reasons, go right ahead :-)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (4)
As of 2024-04-26 00:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found