fork(16) download
  1. import java.util.*;
  2. import java.util.regex.*;
  3. import java.lang.*;
  4. import java.io.*;
  5. class Ideone
  6. {
  7. public static void main (String[] args) throws java.lang.Exception
  8. {
  9. String input = "Some words <firstMatch> some words <secondMatch> some more words <ThirdMatch>";
  10. Pattern pattern = Pattern.compile( "<[^>]*>" );
  11. Matcher m = pattern.matcher( input );
  12. while ( m.find() ) {
  13. System.out.println( m.group(0) );
  14. }
  15. }
  16. }
Success #stdin #stdout 0.05s 711168KB
stdin
Standard input is empty
stdout
<firstMatch>
<secondMatch>
<ThirdMatch>