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

Thierry Douez th.douez at gmail.com
Fri May 19 13:55:42 CEST 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
network
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
enough.


PCRE library accepts the 2 forms.

HTH,

Thierry
​
-- 
------------------------------------------------
Thierry Douez - sunny-tdz.com
sunnYrex - sunnYtext2speech - sunnYperl - sunnYmidi - sunnYmage


More information about the use-livecode mailing list