fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4. import java.util.regex.*;
  5.  
  6. class Ideone
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. Pattern p = Pattern.compile("[\\p{Punct}&&[^\"]]");
  11. Matcher m = p.matcher(" Привет, друг! Как дела? У вот плохая погода...");
  12. while (m.find()) {
  13. System.out.println(m.start()+" "+m.group()+" ");
  14. }
  15. }
  16. }
Success #stdin #stdout 0.14s 36592KB
stdin
Standard input is empty
stdout
7 , 
13 ! 
23 ? 
44 . 
45 . 
46 .