RegEx Replace Text -- strip leading and trailing spaces
rbarber at yhb.att.ne.jp
Thu Apr 14 08:19:03 CDT 2005
On Apr 14, 2005, at 3:52 AM, Wouter wrote:
> On 14 Apr 2005, at 01:49, Ken Ray wrote:
>> On 4/13/05 2:47 PM, "Trevor DeVore" <lists at mangomultimedia.com> wrote:
>>> get matchText(pString, "(?s)^[ \t\r\n]+(.*?)[ \t\r\n]+$", tReturnVal)
> Wow, lots of things happen when sleeping :-).
> The matchtext version is soooo much slower (about 30x which makes it
> for me a no no in an extended repeat loop).
I forgot where in your script you are using the matchtext but in a
recent script, I was using matchtext on a large variable and it was
taking a long time. When I switched and called matchtext for each line
in a repeat for each loop, it became considerably faster:
put matchtext(bigtextvar,regex) into newtext was slow but
repeat for each line l in bigtextvar
put matchtext(l,regex) & return after newtext
was much faster.
More information about the use-livecode