Simple MatchChunk question

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

kaveh1000
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 508
Joined: Sun Dec 18, 2011 7:23 pm
Location: London
Contact:

Re: Simple MatchChunk question

Post by kaveh1000 » Wed Nov 24, 2021 5:10 pm

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.
Kaveh

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Simple MatchChunk question

Post by jacque » Thu Nov 25, 2021 6:36 pm

I may be misunderstanding but is replaceText what you need?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

kaveh1000
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 508
Joined: Sun Dec 18, 2011 7:23 pm
Location: London
Contact:

Re: Simple MatchChunk question

Post by kaveh1000 » Thu Nov 25, 2021 6:40 pm

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.
Kaveh

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Simple MatchChunk question

Post by jacque » Fri Nov 26, 2021 6:38 pm

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

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”