Are there any way to apply regexp in java ignoring letter case?

Posted by Roman on Stack Overflow See other posts from Stack Overflow or by Roman
Published on 2010-06-03T11:58:37Z Indexed on 2010/06/03 12:04 UTC
Read the original article Hit count: 205

Filed under:
|
|

Simple example: we have string "Some sample string Of Text". And I want to filter out all stop words (i.e. "some" and "of") but I don't want to change letter case of other words which should be retained.

If letter case was unimportant I would do this:

str.toLowerCase().replaceAll ("a|the|of|some|any", "");

Is there an "ignore case" solution with regular expressions in java?

© Stack Overflow or respective owner

Related posts about java

Related posts about regex