A Curious Animal
Bla, bla, bla, ..., (evolution) , ..., blog, blog, blog, ...
Bla, bla, bla, ..., (evolution) , ..., blog, blog, blog, ...
Sun, 13 Sep, 2009
If like me, you need to parse some text using regular expressions and it must be done in a casi insensitive way, here is the trick you are looking for.
If you use the Pattern class approach, then add the Pattern.CASE_INSENSITIVE flag:
Pattern p = Pattern.compile("YOUR_REGEX", Pattern.CASE_INSENSITIVE);
If you prefer to use the String.matches() method, then use the ?i flag in the regular expression:
"XYZxyz".matches("(?i)[a-z]+")
I want to note I found this help on: http://blogs.sun.com/xuemingshen/entry/case_insensitive_matching_in_java.
Recent comments
7 weeks 3 days ago
14 weeks 5 days ago
1 year 14 hours ago
1 year 20 weeks ago
1 year 20 weeks ago