Skip to content

Instantly share code, notes, and snippets.

@wdfx100
Created August 10, 2013 14:10
Show Gist options
  • Save wdfx100/6200582 to your computer and use it in GitHub Desktop.
Save wdfx100/6200582 to your computer and use it in GitHub Desktop.
根据正则表达式查找@的用户
Pattern p = Pattern.compile("@\\w+\\s");
String str = "@tom @jerry @rose 这是我的电子邮件,给我发邮件哦[email protected]";
Matcher m = p.matcher(str);
while(m.find()) {
System.out.println(m.group());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment