How to match a regex pattern in case insensitive?
Finding the next subsequence of the input sequence that matches the pattern while ignoring the case of the string in regular expression can simply applied by create a pattern using compile(String regex, int flags) method and specifies a second argument with PATTERN.CASE_INSENSITIVE constant.
Here is the result of the program:
Text "brown" found at 10 to 15.
Text "BROWN" found at 24 to 29.