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

If you find an issue in LiveCode but are having difficulty pinning down a reliable recipe or want to sanity-check your findings with others, this is the place.

Please have one thread per issue, and try to summarize the issue concisely in the thread title so others can find related issues here.

Moderator: Klaus

Post Reply
stam
Posts: 3069
Joined: Sun Jun 04, 2006 9:39 pm

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

Post by stam » Mon Apr 04, 2022 7:13 pm

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
Last edited by stam on Mon Apr 04, 2022 8:00 pm, edited 1 time in total.

stam
Posts: 3069
Joined: Sun Jun 04, 2006 9:39 pm

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

Post by stam » Mon Apr 04, 2022 7:21 pm

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 ;)

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10315
Joined: Wed May 06, 2009 2:28 pm

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

Post by dunbarx » Mon Apr 04, 2022 8:46 pm

Stam.

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

Craig

Post Reply