fork(1) download
  1. import java.util.*;
  2. import java.util.regex.*;
  3.  
  4.  
  5. class rTest {
  6. public static void main (String[] args) {
  7.  
  8. String result = "<input type=\"hidden\" name=\"token\" value=\"YToxOntzOjU\"/>";
  9.  
  10. Pattern pattern = Pattern.compile("name=\"(token)\"[^>]*value=\"([^\"]+)\"", 2);
  11. Matcher matcher = pattern.matcher(result);
  12.  
  13. if (matcher.find()) {
  14. String value = matcher.group(2);
  15. System.out.println(value);
  16. }
  17.  
  18. }
  19. }
Success #stdin #stdout 0.08s 380160KB
stdin
Standard input is empty
stdout
YToxOntzOjU