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

Tiemo Hollmann TB toolbook at kestner.de
Fri May 19 08:14:17 EDT 2017


Is there life without internet for one week? - lucky you are connected to the world again!
Tiemo


-----Ursprüngliche Nachricht-----
Von: use-livecode [mailto:use-livecode-bounces at lists.runrev.com] Im Auftrag von Thierry Douez via use-livecode
Gesendet: Freitag, 19. Mai 2017 13:56
An: How to use LiveCode <use-livecode at lists.runrev.com>
Cc: Thierry Douez <th.douez at gmail.com>
Betreff: Re: filter? replace? wildcard? reg exp? help please!

>
>
>> 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 _______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list