Java Regex IndexOf
public static int regexIndexOf(String str, Pattern pattern) {
int pos;
try {
Matcher m = pattern.matcher(str);
if (m.find()) {
pos = m.start();
} else pos = -1;
} catch (Throwable e) {
pos = -1;
}
return pos;
}