perl regex modifiers

Mark Brownell gizmotron at earthlink.net
Fri Jul 25 20:25:01 EDT 2003


On Friday, July 25, 2003, at 04:23  PM, Alex Rice 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.

How true, testing this I get:

   "perlRegEx = 13,  PNLP = 3" using:

on mouseUp
   put "Do a <perl>web search for Perl regular expressions</perl> 
tutorials," into myVar
   put "<perl>(.*)(</perl>)" into regEx

   -- perlRegEx
   put the milliseconds into tStartTime
   repeat with x = 1 to 500
     put matchText(myVar, regEx, tElement) into bbYes
   end repeat
   put (the milliseconds - tStartTime) into ptTime
   answer tElement

   -- PNLP
   put the milliseconds into tStartTime
   repeat with i = 1 to 500
     put offset("<perl>", myVar) into tNumA
     put offset("</perl>", myVar) into tNumB
     put char (tNumA + 6) to (tNumB - 1) of myVar into tElement
   end repeat
   put (the milliseconds - tStartTime) into otTime
   answer tElement

   -- show results
   answer "perlRegEx = "  & ptTime   & ", PNLP = "  & otTime
end mouseUp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 1377 bytes
Desc: not available
URL: <http://lists.runrev.com/pipermail/use-livecode/attachments/20030725/42dd0996/attachment.bin>


More information about the use-livecode mailing list