How can i make the following regex ignore case sensitive, and match all with the correct chars, but ignore wheter it is lower or uppercase?
G[a-b].*
|
How can i make the following regex ignore case sensitive, and match all with the correct chars, but ignore wheter it is lower or uppercase?
|
|||
|
Assuming you want the whole regex to ignore case, you should look for the
Check the documentation for your language/platform/tool to find how the matching modes are specified. If you want only part of the regex to be case insensitive (as my original answer presumed), then you have two options:
One last note: if you're dealing with Unicode characters besides ASCII, check whether or not your regex engine properly supports them. |
||||
|
|
|
Depends on implementation but I would use
|
|||||||||
|
|
The |
|||
|
|
|
Just for the sake of completeness I wanted to add the solution for regular expressions in C++ with Unicode:
|
|||||
|
|
You also can lead your initial string, which you are going to check for pattern matching, to lower case. And using in your pattern lower case symbols respectively . |
|||
|
|
|
As I discovered from this similar post (ignorecase in AWK), on old versions of awk (such as on vanilla Mac OS X), you may need to use
|
|||
|
|
|
regular expression for validate 'abc' ignoring case sensitive
|
|||
|
|
Pattern pattern = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);. – james.garriss Aug 6 '14 at 14:06