Page 1 of 1

Full stop (period) interpreted as wildcard?![solved]

Posted: Mon Apr 04, 2022 7:13 pm
by stam
Hi all,

in my adventures in livecodescriptland, i came across this bizzaro:

Code: Select all

put replaceText("text.one.two", ".", ",") 
returns

Code: Select all

,,,,,,,,,,,,
instead of text,one,two as a i would have expected...
surely a bug?

Grateful if others can confirm (or correct me!)
Stam

Re: Full stop (period) interpreted as wildcard?!

Posted: Mon Apr 04, 2022 7:21 pm
by stam
to answer my own question, it seems replacetext actually takes regular expressions, so the full stop "." has to be 'escaped' with a '\'

ie the correct expression is

Code: Select all

put replaceText("text.one.two", "\.", ",") 
feel free to ignore me ;)

Re: Full stop (period) interpreted as wildcard?![solved]

Posted: Mon Apr 04, 2022 8:46 pm
by dunbarx
Stam.

Ignore? No. You are just my kind of guy.

Craig