Regex efficience/performance comparing these different types of constructions: \btheor(y\b|ies\b) X \btheory\b|\btheories\b -
I am writing an expression in which building blocks will follow any of these two types (or if you have suggestions Other):
Expression 1: Expression 2: Since I am a newbie, just started in Reggae, my issue is that you have full efficiency, fast output / regex search Want to know the result of real expression (like expression 1 structure) and will be running in big database (5.000 pdf): I advise @ JonathonReinhart at home I want to drive, so I'll start by copying: PRIP # 1: Keep it simple # 2 Predict: Test your doubts: Whatever your language or system offers Use both to code and time code. If more complex options are not fast fast, then forget about using it. However, to answer your question directly, the expression one will be more efficient for writing regular expressions from left to write and many characters as possible Try to eat (food). So tell that you have string With thier (y | ies) , regex will first successfully match with Hopefully it is very easy that there are fewer possibilities to go through the first one and try to match, besides doing it (sometimes slightly), besides, I think the first expression is very much It is clear..and the fact is that it is small, there will be a big difference in readability if you unite many of these. If you can not see this from my statement, check these debuggers: \ btheor (y \ b | ies \ b)
\ btheory \ b | \ Btheories \ b (... all the variations of written words)
theor (y \ b | ies \ b) . {0,30} \ bWORD \ b | (? S \ b). Perspective {0,30} \ bWORD \ b | Approa (ch \ b | stitches \ b) {0,30} \ bWORD \ b |.? Pattern (s as \ b |? \ B) {0,30} \ bWORD \ b |.? Method (s \ b) {0,30} \ bWORD \ b |. M.todo (s \ b) {} 0,30 \ BWORD \ b | Methodolog (y \ b | ies \ b). {0,30} \ bWORD \ b
principles .
t ,
h ,
e ,
o , and
r . Then, it will try to match
y and will fail, then it can be successfully filled with
i ,
e , and
s Will match.
(theory) | (Theory) , regex will first successfully match
t ,
h ,
e ,
o , And
r . After failing on
y , he has to go back and re-match
t ,
h ,
Before finalizing the last
i ,
e , and
, ,
o , and
r .
Comments
Post a Comment