INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: RegEx case sensitivity bug  (Read 311 times)

TAJ-767

  • Recent member
  • *
  • Posts: 14
RegEx case sensitivity bug
« on: December 22, 2020, 06:20:28 pm »

(context)
I would like names that indicate a minor key to show the key in lower case, and names that indicate a major key to show the key in upper case.

So I am using RegEx to find names with the wrong case for key signature.  That is, I want RegEx to find "Symphony in A minor" but not "Symphony in a minor"  (and vice versa for major keys).
(/context)

According to the wiki:
The case sensitivity argument toggles the case-sensitivity of regular expression matching. Note that case insensitivity does not apply to characters inside a character class [ ]. Use both uppercase and lowercase characters when necessary to match either case (e.g. [aAbB] to match either uppercase or lowercase A or B).

However, when I use the following RegEx (without the case sensitivity flag) in a smartlist:

[=regex([name],/#\b[A-G]\s*minor)\b#/,0)]=1

I get both "Symphony in A minor" and "Symphony in a minor"

When I turn on the case sensitivity flag like this:

[=regex([name],/#\b[A-G]\s*minor)\b#/,0,1)]=1

It works correctly and only returns "Symphony in A minor"
Logged
Pages: [1]   Go Up