@stam,
I agree with you that the regex "\R" is the correct one.
I should have said, it seems like LiveCode's replaceText function wrongly interprets the regex "\n" as "\r", and doesn't correctly interpret the regex "\r". Sorry about swapping the two.
Here's what convinced me of that:
This code:
Code: Select all
local tText
put cr & cr & cr & "test" & cr & cr & cr into tText
put replaceText(replaceText(replaceText(tText,"^\n",""),"\n\n",""),"\n$","")
removes the empty lines delimited by the CR characters, whereas is should not, because the regex "\n" should not match CR.
And this code:
Code: Select all
local tText
put cr & cr & cr & "test" & cr & cr & cr into tText
put replaceText(replaceText(replaceText(tText,"^\r",""),"\r\r",""),"\r$","")
should remove the CR characters, but doesn't.
Gerrie
PS: Yes, I'm with you on the "filter lines ...", it does work perfectly. I'm only trying to point out what seems to be a bug in the replaceText function.