PsychoSpunk has asked for the wisdom of the Perl Monks concerning the following question:
It was then that the words hit me, "The Perl Engine uses a nondeterministic finite state automaton to find a match. ... If you're cagey, you can write efficient patterns that don't do a lot of silly backtracking."
At that moment I had a "Eureka!" I remembered from my own studies that finite state automata have mathematical rules that allow you to work with them in a somewhat algebraic manner. And during those studies, we discussed that there exists software whose purpose is to reduce these automata to their optimal expressions. I think you may understand everything now.
What I am wondering is simple: Does a regular expression optimizer exist currently? There is no doubt in my mind that if it doesn't, that it is entirely possible to write one. But that is not of importance to me at this moment. If none exist, then I may embark on that journey in the future.
What is acceptable of such a device that spits out optimized regexes? Obviously, I would like to get the best regex possible no matter if I put in a horrible regex or a better version of the same horrible regex. (ie - r1 => ro and r2 => ro if r1 <s>~</s> r2) I don't think that time constraints are entirely important. Of course, I don't want to wait five years for an optimal regex, but if I give it a crappy regex, I expect that I'll have to wait longer than if I gave it a better version of the regex. In other words, it solves your problems based on the step you start it on.
I guess that covers the two basic requirements I would have for a regex optimizer.
ALL HAIL BRAK!!!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Regular Expression Optimizer
by jlistf (Monk) on Aug 31, 2000 at 01:21 UTC | |
|
RE: Regular Expression Optimizer
by BlaisePascal (Monk) on Aug 31, 2000 at 01:23 UTC | |
by tilly (Archbishop) on Aug 31, 2000 at 02:09 UTC | |
by BlaisePascal (Monk) on Aug 31, 2000 at 02:33 UTC | |
by PsychoSpunk (Hermit) on Aug 31, 2000 at 02:59 UTC | |
by BlaisePascal (Monk) on Aug 31, 2000 at 05:34 UTC | |
by tilly (Archbishop) on Aug 31, 2000 at 06:12 UTC | |
by PsychoSpunk (Hermit) on Aug 31, 2000 at 08:30 UTC | |
|
Re: Regular Expression Optimizer
by indigo (Scribe) on Aug 31, 2000 at 01:35 UTC | |
|
RE (tilly) 1: Regular Expression Optimizer
by tilly (Archbishop) on Aug 31, 2000 at 02:18 UTC |