static boolean isRegexPrefixedPattern(String pattern) {
   int indexOfRegex = pattern.indexOf(SelectorUtils.REGEX_HANDLER_PREFIX);
   int prefixLength = SelectorUtils.REGEX_HANDLER_PREFIX.length();
   if (indexOfRegex != -1) {
     if (indexOfRegex != 0
         || !pattern.endsWith(SelectorUtils.PATTERN_HANDLER_SUFFIX)
         || pattern.indexOf(SelectorUtils.REGEX_HANDLER_PREFIX, prefixLength) != -1) {
       String msg =
           "Illegal test|includes|excludes regex '%s'. Expected %%regex[class#method] "
               + "or !%%regex[class#method] "
               + "with optional class or #method.";
       throw new IllegalArgumentException(String.format(msg, pattern));
     }
     return true;
   } else {
     return false;
   }
 }
 static String[] unwrapRegex(String regex) {
   regex = regex.trim();
   int from = SelectorUtils.REGEX_HANDLER_PREFIX.length();
   int to = regex.length() - SelectorUtils.PATTERN_HANDLER_SUFFIX.length();
   return unwrap(regex.substring(from, to));
 }