Skip to content

Instantly share code, notes, and snippets.

@pcon
Created January 10, 2014 21:49
Show Gist options
  • Save pcon/8363353 to your computer and use it in GitHub Desktop.
Save pcon/8363353 to your computer and use it in GitHub Desktop.
Pattern Matcher SFDC
public static String extractRefId(String orgId, String testString) {
pattern myPattern = pattern.compile('(?m).*\\[ ref:(.*)\\.(.*):ref \\].*');
matcher myMatcher = myPattern.matcher(testString);
if (myMatcher.matches()) {
if (myMatcher.group(1) == orgId) {
return myMatcher.group(2);
}
}
return null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment