java - how to ignore the "dots" in quotation marks -


I want to ignore . What should I do in quotes?

Example sentence:

  string sentence = "I love you." I'm sorry. But love someone else, "he told me.";  

There are three . But I want to ignore . There are two quotation marks for the sum of sentences.

My code and I have some regex:

  public static string [] Ignore word (string word) {string [] arrWords = word.replaceAll (", * |, * | - * | - * | \\ (* | \\) * | \\ {* | \\} * | \\} * | \\ {* | \\} * " , "") .split ("\\."); Return arrWords;}  

  \. (? = (?: [^ "] *" [^ "] *") * [^ "] * $)  

Try it.


Comments