We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
...the program was still case sensitive. I looked up some resources online. It does not appear to be a bug with the programming language. I even tried using the Pattern.MULTILINE flag, but this flag setter does not seem to work either. I ended up having to incorporate the case insensitivity in the regex string like this:
(**Where (?i) sets everything following to be case insensitive)
I am not sure if I was doing something wrong here. It seems like setting that CASE_INSENSITIVE flag should have been enough, but it seemed to have no effect at all.
I was able to solve all of the test cases. However, this inconvenience continues to baffles me. It seems like no one else was having any issues with the CASE_INSENSITIVE flag.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Java Regex 2 - Duplicate Words
You are viewing a single comment's thread. Return to all comments →
I was having trouble setting the CASE_INSENSITIVE flag on the pattern. After setting the pattern like so...
...the program was still case sensitive. I looked up some resources online. It does not appear to be a bug with the programming language. I even tried using the Pattern.MULTILINE flag, but this flag setter does not seem to work either. I ended up having to incorporate the case insensitivity in the regex string like this:
(**Where (?i) sets everything following to be case insensitive)
I am not sure if I was doing something wrong here. It seems like setting that CASE_INSENSITIVE flag should have been enough, but it seemed to have no effect at all.
I was able to solve all of the test cases. However, this inconvenience continues to baffles me. It seems like no one else was having any issues with the CASE_INSENSITIVE flag.