AW: How trim: Bug in RegExp engine + docWiki

briany at qldlearning.com briany at qldlearning.com
Tue Oct 25 19:40:55 EDT 2005


All,

What about using something like this as an interim solution to filter +
regex?

I'm sure this could be improved, but basically it just runs through the
text one line at a time and uses matchText to filter in/out the matching
lines.

on regexFilter @t,expr
  local tmp,l,outLine
  repeat for each line l in t
    if (matchText(l, "("&expr&")", outLine) AND (l = outLine)) then
      put l&cr after tmp
    end if
  end repeat
  delete last char of tmp
  put tmp into t
end regexFilter

Example:

put "AC"&cr&"BD"&"CC" into tText
regexFilter tText,"[AB][BC]"
// tText => "AC"



More information about the use-livecode mailing list