thufir

regex

Sep 2nd, 2013
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.44 KB | None | 0 0
  1. package regex;
  2.  
  3. import java.util.regex.Matcher;
  4. import java.util.regex.Pattern;
  5.  
  6. public class Regex {
  7.     public static void main(String[] args) {
  8.         String s = "HP: 648/648  CP: 654/657 ADRENALINE: 105 ENDORPHINE: 0  BERSERK: 10 None: 0% ";
  9.         Pattern p = Pattern.compile("^HP:\\b(\\d+)");
  10.         Matcher m = p.matcher(s);
  11.         boolean foo = m.find();
  12.         //String go = m.group(0);
  13.         String g1 = m.group();
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment