SHARE
TWEET

Untitled

a guest Jun 20th, 2019 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. String regExp = "YOUR_REGEXP_HERE";
  2. Pattern mPattern = Pattern.compile(regExp)
  3.      
  4. public List<String> getGroupsFromString(String input, String pattern) {
  5.     Pattern mPattern = Pattern.compile(pattern);
  6.     Matcher mMatcher = mPattern.matcher(input);
  7.     List<String> toReturn = new LinkedList<>();
  8.  
  9.     while(mMatcher.find()) {
  10.         toReturn.add(mMatcher.group());
  11.     }
  12.  
  13.     return toReturn;
  14. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top