How to ignore "periods" in quotes
I want to ignore .
quotes. what should i use regex?
example sentences:
String sentence = "i love you. \"i'm sorry. but love someone else,\" he said to me. ";
there are three .
, but I want to ignore .
the quotes so that the sentence sum is two.
my code and some regex I have:
public static String[] ignoreWord(String word){
String [] arrWords = word.replaceAll(", *| , *|- *| - *|\\( *| \\( *|\\) *|\\{ *| \\} *| \\} *| \\{*|\\} *", " ").split("\\. ");
return arrWords;
}
+3
source to share