fork(1) download
  1. import java.util.*;
  2. import java.util.regex.*;
  3. import java.lang.*;
  4. import java.io.*;
  5.  
  6. class Ideone
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. String linha = "Jõao Ferreira da Silva";
  11. String pattern = "\\S+";
  12.  
  13. Pattern r = Pattern.compile(pattern);
  14. Matcher m = r.matcher(linha);
  15. if (m.find( )) {
  16. System.out.println(m.group(0) );
  17. }
  18. }
  19. }
Success #stdin #stdout 0.04s 711168KB
stdin
Standard input is empty
stdout
Jõao