Replacetext conundrum
Martin Baxter
mb.ur at harbourhost.co.uk
Thu Apr 6 15:22:58 EDT 2006
Rob Beynon wrote:
> Dear All
>
> Why does (in the message box even, but also in scripts)
>
> put the replacetext("dah at dah","@",".") give "dah.dah"
>
> but
>
> put the replacetext("dah.dah",".","@") give "@ @ @ @ @ @ @"
>
> this is surely a bug?
>
>
I think not a bug, unless you mean why are there spaces between the ats
in the result? I would expect the ats but not the spaces. Is that really
what you get?
The dot as second parameter has special meaning in regular expressions -
it means "any character" essentially, so it will cause all characters in
param 1 get replaced with param 3. Try this:
put the replacetext("dah.dah","\.","@")
The backslash tells RR to treat the dot as a literal.
Martin Baxter
More information about the use-livecode
mailing list