Regular expressions

Thierry Douez th.douez at
Wed Oct 9 06:29:41 EDT 2013

Hi Terry,

I guess you may like to participate  in this thread:



2013/7/2 Terry Vogelaar <tvogelaar at>
stringToChange: <body><span>Block of text</span></body>
matchExpression: <span>[^<]+</span>
replacementString: <div>?</div>
result: <body><div><span>Block of text</span></div></body>

The question-mark fills in everything that matches the matchExpression.
Very useful when you want to put something around the found instances.

Or you can even take it a step further by using ( and ) in combination with
\1, \2 etc.:

stringToChange: <body><span class="MakeMeVisible">Block of
matchExpression: <span class="([^"]+)">([^<]+)</span>
replacementString: <span>\1: \2</span>
result: <body><span>MakeMeVisible: Block of text</span></body>

The \1 fills in what it found inside the first pair of parentheses; the \2
the second pair. This way you can do really powerful replacements, if you
know what you are doing.

Thierry Douez -
Maker of sunnYperl - sunnYmidi - sunnYmage

More information about the Use-livecode mailing list