Search / replace
Mike Bonner
bonnmike at gmail.com
Sat Feb 20 13:28:07 EST 2010
If you want do the search/replace with regex, you can do similar to this..
put replaceText(field "Field","(?<=\d)\[","-") into tTmp
put replaceText(tTmp,"(?<!\d)\[",empty) into tComplete
This does a look behind.
First setup the look behind with (?<=\d) This will match a digit, but
only a digit that is next to the \[ that is outside the parens.
Basically, if finds the [ then checks to see if there is a digit to
the left. If there is, it does the replace of the [.
The first is a positive look behind, meaning it will match if the
string in parens exist. The 2nd is a negative look behind that will
match for any [ that do NOT have a digit to the left of the [.
Works really well.
If you want to learn more about regex (they can be REALLY amazingly
helpful if a bit obtuse to understand) check here.
http://www.regular-expressions.info/quickstart.html
More information about the use-livecode
mailing list