Still a good one to keep in your pocket anyway. While the regular expression is powerful, you might have already guessed that it is also very “inhuman” and difficult to use.
![regular expression not case sensitive regular expression not case sensitive](https://dataschool.com/assets/images/how-to-teach-people-sql/appendix/how_regex_works/posixTable.png)
It is most likely a case sensitive comparison “out-of-the-box”, see below for the case-insensitive example. IMPORTANT NOTE – How localeCompare() works pretty much depend on the browser implementation and the user’s current locale.To make a regular expression case insensitive, substitute individual characters. -1 when STRING-A is “alphabetically before” STRING-B. However, this regular expression does not match a one-digit or two-digit.When testing a case-sensitive Regular Expression (RegEx) definition, it matches lower and uppercase text strings as if the Regular Expression is case-insensitive.
![regular expression not case sensitive regular expression not case sensitive](https://online-metrics.com/wp-content/uploads/2015/01/GA-attach-hostname-to-request-URI.png)
![regular expression not case sensitive regular expression not case sensitive](https://community.easymorph.com/uploads/default/original/2X/4/48dd101576a3e8ef4dce514aac993da64aefab58.png)
1 when STRING-A is “alphabetically after” STRING-B. Regular Expressions are not case sensitive new kc.As with the above example, STRING-A.localeCompare(STRING-B) will return: Next, we have a rather “advanced comparison” method using localeCompare(). Console.log(first.localeCompare(second)) // "A" is before "B", expected output -1Ĭonsole.log(second.localeCompare(first)) // "B" is after "A", expected output 1Ĭonsole.log(first.localeCompare(second)) // The same, expected output 0Ĭonsole.log(first.localeCompare(second)) // Car is "alphabetically before" Cow, so expected -1Ĭonsole.log(second.localeCompare(first)) // Cow is "alphabetically after" Car, so expected 1