import java.util.regex.*; public class Regexp { public static void main(String []args) { String input = "- How are you today?\n- Fine! Thank you.\n- You 're welcome."; // Βρες τα σημεία στίξης στην αρχή και το τέλος του δοθέντως αλφαριθμητικού Pattern p = Pattern.compile("^\\p{Punct}|\\p{Punct}$"); Matcher m = p.matcher(input); while(m.find()) { System.out.println("Found: "+input.substring(m.start(), m.end()) +", at: "+m.start() ); } } }