filter? replace? wildcard? reg exp? help please!

Thierry Douez th.douez at
Fri May 19 07:55:42 EDT 2017

>> put "1 [A] 2 [B] 3." into tText
>> put  removeBrackets( tText)
> I see that the middle section is omitted with my regex, so I forgot to
> make it non-greedy. But I've forgotten how to do that, something about a
> question mark, I think?

​Sorry about the delay, we had a thunderstorm which broke all Internet
in our area since last Friday.

You can do this in 2 ways:

- make your .* non greedy by adding a '?' suffix

- or modify your regex this way:

   "\[ [^\]]*]" which means looking for an open bracket followed by zero to
any number of chars which are not a close bracket, and last a close bracket.
BTW, no need to escape the last closing bracket; the regex engine is smart

PCRE library accepts the 2 forms.


Thierry Douez -
sunnYrex - sunnYtext2speech - sunnYperl - sunnYmidi - sunnYmage

More information about the use-livecode mailing list