Skip to content

Instantly share code, notes, and snippets.

@mtetlow
Created September 12, 2013 15:58
Show Gist options
  • Save mtetlow/6539895 to your computer and use it in GitHub Desktop.
Save mtetlow/6539895 to your computer and use it in GitHub Desktop.
Pattern tagSafe = Pattern.compile('[a-zA-Z\\s\\d\\-_]');
Matcher tagSafeMatcher = tagSafe.matcher('Pyramid Construction Inc1234_-.');
String[] strArr = new String[]{};
while(tagSafeMatcher.find()){
system.debug(tagSafeMatcher.group(0));
strArr.add(tagSafeMatcher.group(0));
}
system.debug(String.join(strArr,''));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment