import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
public static void main(String[] args) {
final String regex = "rev(enue )?(op(eration)?s?)|g(?:o(?:-|\\s)to(?:-|\\s))?m(?:arket)?(?:\\s*(?:ops|operations))?|sales\\s*(ops|operations|analysts?|bi|intelligence|enablement|data|automation)|crm manager|business systems|(growth|market(ing)?)\\s*(operations|ops)";
final String string = " \"Revenue Ops Manager\",\n"
+ " \"Growth Marketing Manager\",\n"
+ " \"CEO\",\n"
+ " \"Director of Operations\",\n"
+ " \"Sales Ops Analyst\",\n"
+ " \"VP of Sales\",\n"
+ " \"Marketing Operations Specialist\",\n"
+ " \"Lead Generation Manager\",\n"
+ " \"Product Ops Director\",\n"
+ " \"GTM Strategy Lead\",\n"
+ " \"Head of Growth\",\n"
+ " \"Chief Marketing Officer\",\n"
+ " \"Director of Business Development\",\n"
+ " \"Junior Revenue Analyst\",\n"
+ " \"Freelance Growth Consultant\",\n"
+ " \"CTO and Product Owner\",\n"
+ " \"Sales Development Representative\",\n"
+ " \"Intern Marketing Operations\",\n"
+ " \"Business Systems Administrator\",\n"
+ " \"Country Manager and COO\",\n"
+ " \"Chief Growth Officer\",\n"
+ " \"VP Marketing and Communications\",\n"
+ " \"Head of Business Opportunities\",\n"
+ " \"Revenue Operations Specialist\",\n"
+ " \"Product Marketing Manager\"\n"
+ "Revenue Ops\n"
+ "RevOps\n"
+ "Chief Revenue Officer\n"
+ "CRO\n"
+ "CMO";
final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE | Pattern.CASE_INSENSITIVE);
final Matcher matcher = pattern.matcher(string);
while (matcher.find()) {
System.out.println("Full match: " + matcher.group(0));
for (int i = 1; i <= matcher.groupCount(); i++) {
System.out.println("Group " + i + ": " + matcher.group(i));
}
}
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Java, please visit: https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html