Matchtext/Regex Case Insensitive Flag

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

Post Reply
Lagi Pittas
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 365
Joined: Mon Jun 10, 2013 1:32 pm

Matchtext/Regex Case Insensitive Flag

Post by Lagi Pittas » Tue Apr 07, 2015 7:24 pm

Hi

I've been trying to get Matchtext to match 3 diifferent words but just incase wanted too make it case insensitive. In my current routine it doesn't really matter.

Im trying matchtext(lcString,"Note|Name|Add") which works but if i add /i to make it case insensitive, it has no effect unless there is a LC way of adding it.

I have use forward slash and backslash (just in case) and it doesn't work.

Regards Lagi

Lagi Pittas
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 365
Joined: Mon Jun 10, 2013 1:32 pm

Re: Matchtext/Regex Case Insensitive Flag

Post by Lagi Pittas » Wed Apr 08, 2015 10:19 am

Hi

Since nobody has piped up I have to assume it doesn't work and since the livecode documentation says it is PCRE compatible that means it's a bug.
Or is this just an Undocumented Feature?

I even used s"et the casesensitive to false" and that had no effect either so I have reverted to a kludge by enclosing the match string in a toupper().

Is there a list of where LC doesn't agree with the PCRE "standard".

Regards Lagi

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

Re: Matchtext/Regex Case Insensitive Flag

Post by Thierry » Wed Apr 08, 2015 10:44 am

Hi Laggi,
Lagi Pittas wrote: Since nobody has piped up I have to assume it doesn't work
Hey, you're jumping a bit too fast to the conclusion, which is wrong by the way :)
and since the livecode documentation says it is PCRE compatible that means it's a bug.
Or is this just an Undocumented Feature?
It is documented somewhere in the dictionnary..
I even used s"et the casesensitive to false"
Good try, but unrelated to regex.
Is there a list of where LC doesn't agree with the PCRE "standard".
LC uses PCRE 8.33 library and as far as I know, it respects the PCRE standard.

In Livecode, just do that:

Code: Select all

   if matchText( T, "(?i)x|y|z" ) then ..
All options (or mode) are in front of the Regex.
Same for multi-line, dot-match,...

HTH,

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

Lagi Pittas
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 365
Joined: Mon Jun 10, 2013 1:32 pm

Re: Matchtext/Regex Case Insensitive Flag

Post by Lagi Pittas » Wed Apr 08, 2015 11:31 am

Thanks Thierry

RTFM (read The Fine Manual)

Went back and saw this

Code: Select all

The string and regularExpression are always case-sensitive, regardless of the setting of the caseSensitive property. (If you need to make a case-insensitive comparison, use "(?i)" at the start of the regularExpression to make the match case-insensitive.)
The problem was I ASSumed that it would be in the same order as it gave me no error - but reconsidering it was taking them as characters.

I was clutching at straws with the the casesensitive flag

But Anyways my subtle plan worked - call it a bug and the "Knights of LiveCode" will appear :twisted:

As McDonalds would say "I'm lovin It!!" :D

Thanks again Thierry

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

Re: Matchtext/Regex Case Insensitive Flag

Post by Thierry » Wed Apr 08, 2015 11:42 am

Lagi Pittas wrote:Thanks Thierry

RTFM (read The Fine Manual)
Unfortunately, not always true :(
But Anyways my subtle plan worked - call it a bug and the "Knights of LiveCode" will appear :twisted:
Wrong conclusion again :)
When I post my previous answer, I would have done it with your 1st post too.
Just pass here during my free time...
Plus, for most of livecoders, regexes are just hellish :roll: ; so don't have too much expectations...
As McDonalds would say "I'm lovin It!!" :D
Here, I'm lost :)

Best,

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

Lagi Pittas
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 365
Joined: Mon Jun 10, 2013 1:32 pm

Re: Matchtext/Regex Case Insensitive Flag

Post by Lagi Pittas » Wed Apr 08, 2015 12:41 pm

Hi Thierry,

In this case it WAS true, but usually F stands for something else ....

With 50 views and no answer what could I Assume - I just should have read 1 line further in the Docs.

I'M loving it - means I'm enjoying LC - there are many things that could be better - especially the IDE crashing more in 1 Day (not just 1 day) than the VISUAL FOXPRO IDE crashed in 20 years and no that is not an exaggeration.

There isn't much I can see that can't be done with LC - just having to adapt to new paradigms and expectations of how things work rather than the way I expect thenm to - thats why I'm Lovin' it.

Regards Lagi

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”