This one can be done without regex, but at times it can get very complicated and far easier with regex.
And a rant here that a major shortcoming of LiveCode is that it can search for regex but it cannot replace regex. A gap that has been filled with SunnYrex by @thierry. Works great.
Simple MatchChunk question
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 7215
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Simple MatchChunk question
I may be misunderstanding but is replaceText what you need?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- Livecode Opensource Backer
- Posts: 508
- Joined: Sun Dec 18, 2011 7:23 pm
- Location: London
- Contact:
Re: Simple MatchChunk question
Hi Jacque
Here I am just trying to find the offset (start and end) of a piece of text (represented by a regular expression). I am not trying to replace it. replacetext will replace the found chunk with something else that I define.
Oh, if you are referring to the last note about no replace option in LiveCode, normally regex can replace a piece of text that is found using replacement strings e.g. \1, \2. This is totally missing in LiveCode. I can give you an example if you like.
Here I am just trying to find the offset (start and end) of a piece of text (represented by a regular expression). I am not trying to replace it. replacetext will replace the found chunk with something else that I define.
Oh, if you are referring to the last note about no replace option in LiveCode, normally regex can replace a piece of text that is found using replacement strings e.g. \1, \2. This is totally missing in LiveCode. I can give you an example if you like.
Kaveh
-
- VIP Livecode Opensource Backer
- Posts: 7215
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Simple MatchChunk question
I see now, you're talking about back references. I've missed that too.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com