Pattern Matching in Livecode

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!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

rkriesel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 119
Joined: Thu Apr 13, 2006 6:25 pm

Re: Pattern Matching in Livecode

Post by rkriesel » Sun Dec 11, 2016 6:47 am

The timings I posted are distorted by what appears to be a bug in LC.

For details, see http://forums.livecode.com/viewtopic.php?f=104&t=28513.

@-hh: Thanks for the suggestion about including the latest version of all submissions, and for the suggestion about testing in other versions of LC, and for deleting the post that contained the suggestions.

@Thierry: It's your regex that exposes the side effect.

@capellan: You're welcome.

-- Dick

rkriesel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 119
Joined: Thu Apr 13, 2006 6:25 pm

Re: Pattern Matching in Livecode

Post by rkriesel » Tue Dec 13, 2016 10:10 pm

@Thierry

Your code and data posted here Thu Nov 10, 2016 11:28 am gave me a good, working, starting point for comparing this thread's functions; my code evolved from yours to suit my purposes. So, thanks for the head start.

Besides that, your first regex contribution turned out, in my opinion, to be by far the best solution because it took so little time to code, especially compared to mine.

-- Dick

Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 875
Joined: Wed Nov 22, 2006 3:42 pm

Re: Pattern Matching in Livecode

Post by Thierry » Wed Dec 21, 2016 10:37 am

rkriesel wrote:@Thierry

Your code and data posted here Thu Nov 10, 2016 11:28 am gave me a good, working, starting point for comparing this thread's functions; my code evolved from yours to suit my purposes. So, thanks for the head start.
Dirk,

Your contribution was even stronger to me:
you have opened the door to identify 2 internal LC bugs which are patched by now.
THIS unblock my sunnYrex library which I could release right after understanding
the patches made by @LCmark, and I got my first customer the same day!
Besides that, your first regex contribution turned out, in my opinion,
to be by far the best solution because it took so little time to code.
Ok, part of the true story:
Reading the 1st post, I didn't understand what to do,
but later, reading Hermann's post then I did but I was too busy then.
Next day, sitting in front of an open fire with a cat on my knees and a cup of coffee,
I could instantly visualize the regex.
and back to the computer, it took me less than 10 minutes to code and post.
Here is the true power of regex; but for that one need to know the syntax and be at ease with
the regex engine.

To summarize:
- regex are usually fast to execute if properly used
- they are fast to code too if used in an appropriate way
- but some say it's hard to read: well, see below

Here is the extended regex of my 1st post:

Code: Select all

^(?:(?:1GHO|2GFD|2GFO|2PLS|2RHD|2RHO|2RHS|3GLO|3PFS|3PHD|3PHS|3PLD)\s){3}
and sunnyRexBeautifer in action:
sunnY 2016-12-21 à 09.12.04.png

Happy Christmas to all,

Thierry
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!

Post Reply