fork download
  1. import java.util.regex.*;
  2.  
  3. class Ideone
  4. {
  5. public static void main (String[] args) throws java.lang.Exception
  6. {
  7. String texto = "oi tudo bem como vai #1234a #sdf #$%ยจ#@)~";
  8. Pattern p = Pattern.compile("#\\S+");
  9. Matcher m = p.matcher(texto);
  10. while(m.find()) {
  11. System.out.println(m.group(0));
  12. }
  13. }
  14. }
Success #stdin #stdout 0.04s 4386816KB
stdin
Standard input is empty
stdout
#1234a
#sdf
#$%¨#@)~