Contains searches for exact Strings, not regexes.
String does have a "matches" method which accepts regexes, but it checks the ENTIRE String. There are two ways around this:
1. Add a wildcard to the front and back of your regex and use String.matches(String regex) method (you need to add a wildcard to account for additional text before and after the regex).
2. Use the Pattern and Matcher classes instead:
Pattern p = Pattern.compile(regex_pattern); // Creates a new Pattern object with the specified regex
Matcher m = p.matcher(inputString); // Creates a new Matcher object from the Pattern, with the String you are wanting to search
boolean exists = m.find(); // Returns true if the regex pattern is found in the String