Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!
There is something happening when the text contains square brackets....
I use square brackets in my text as references to be replaced with other words etc.
I found that using the chunk expression "word" it spits back the word AND period/punctuation mark. I need to use "word" because I don't want to replace ALL the words.
like this:
on mouseup
put "[tomato]" into tMatchword
put field "text" into tText
repeat with tLoop=1 to the number of words in tText
if word tLoop of tText = tMatchword then put random(1000) into word tLoop of tText
end repeat
end mouseup
The problem with this is that the tMatchword will not be found if there is a punctuation mark after a word.
the square brackets have some meanings in a regex;
it's called a character class. If you want to match a square bracket then
you need to escape it, so it is seen as a single char. The trick is you need to
escape only the opening bracket;
the regex engine is smart and then understand what you want
Dos this make sense?
Regards,
Thierry
! SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!
I understood, thanks to you, the use of quotes in a string.
What I notice is that when using the special char "°" which is gotten by <Alt + 0176> it doesn't show in LC6.5.2 on my machine, despite the char "\" in front of it...