perl regex modifiers

Alex Rice alrice at ARCplanning.com
Fri Jul 25 18:31:01 EDT 2003


On Friday, July 25, 2003, at 04:23  PM, Mark Brownell wrote:

> If this optimizes in a repeat loop faster than my offset() repeat loop 
> handler, and I'll bet it does,...

It might not be faster because each call to the regex engine with 
matchText() or the other functions, will cause another parse and 
compile of the regex string by the pcre engine. Unless RR is doing some 
kind of pattern caching, which would be really neat, or worth a 
feature-request.

But using regex you might get more work done for each loop- or 
something.

Perl has a good feature for optimizing regex calls in a loop like this. 
The "o" modifier tells Perl to compile the regular expression 1 time 
only, not every loop iteration.

while(<>){ if(/something/o) { ... }; } # perl

Alex Rice, Software Developer
Architectural Research Consultants, Inc.
http://ARCplanning.com




More information about the use-livecode mailing list