perlquestion
Random_Walk
<p>Greetings wise and ancient monks of the order of Perl</p>
<p>When a regex is run it may take a few steps to match a string, it may back track a little, or it may enter the world of catastrophic backtracking.</p><p>
We have an application where users can create regex patterns to run against a logfile Sometimes the user created patterns stray into the zone of catastrophe, and the servers can spend more CPU trying to match patterns in the logfile than doing real work.</p><p>
I would like a way to pre-validate user's regex against a few hundred sample lines, and ensure that they never enter the world of ridiculous step count. Is there a way to get the regex engine to tell me how many steps it took?</p>
<code>
</code>
<p>Cheers,<br>R.</p>
<div class="pmsig"><div class="pmsig-382261">
Pereant, qui ante nos nostra dixerunt!
</div></div>