replaceText problem

Kay C Lan lan.kc.macmail at gmail.com
Tue Jan 6 21:05:10 EST 2015


On Wed, Jan 7, 2015 at 12:44 AM, Bob Sneidar <bobsneidar at iotecdigital.com>
wrote:

> I read up on this, thinking that LC was implementing some substandard
> regex functionality. Turns out this is the state of affairs in the regex
> world.
>
> I don't know where Pete was reading that certain regex characters are not
supported, and whilst I agree the Dictionary is very scarce with regex
examples in the entry for matchText it states that LC uses the PCRE
implementation of regex. Yes there are different flavours of regex which is
why I like this online regex tester:

https://regex101.com/#pcre

It allows you to select the flavour of regex you want to use; too many of
the other online regex testers are JavaScript based or Python.

This site has a load of example (if you click on the Community tab at the
top) so in many cases you don't even have to write any regex as someone has
already written it for you. It's also nice that if you do write the regex
yourself (or click on one of the examples) the Explanation box at top right
automatically fills with an explanation of what it's doing - which may or
may not match what you're trying to achieve ;-)

But best of all, unlike writing regex in LC which gives you no feedback at
all about your syntax, by using the online test you are given immediate
feedback, i.e. if you enter the regex Pete listed in his original post the
online tester immediately highlights the opening bracket in red - and in
the Explanation box it tells you that it's missing it's closing bracket.
Easy.

If it works on this website it will work in LC.



More information about the use-livecode mailing list