小数点的一定能前后一定有数字的,那么英文的句号应该就是前面非数字,或者后面非数字的都算是句号了split("\\.\\D|\\D\\.");

解决方案 »

  1.   

    楼主试下这个:
    .+?(?:[!?]|$|(?:(?<!\d)\.(?!\d)))
      

  2.   

    上面的正则,我再改下,改成前面的空格也不匹配的
    (?!\s).+?(?:[!?]|$|(?:(?<!\d)\.(?!\d)))下面给个Demo:import java.util.regex.*;public class TestTmp { public static void main(String[] args) {
    String str = "How are u? I am fine! My father was a self-taught mandolin player. He was one of the best string instrument players in our town. He could not read music, but if he heard a tune a few times, he could play it. When he was younger, he was a member of a small country music band. They would play at local dances and on a few occasions would play for the local radio station. He often told us how he had auditioned and earned a position in a band that featured Patsy Cline as their lead singer. He told the family that after he was hired he never went back. Dad was a very religious man. He stated that there was a lot of drinking and cursing the day of his audition and he did not want to be around that type of environment.While having some money does have an impact on our level of happiness, having a lot of money does not. People in the United States whose income goes from US$20,000 a year to US$50,000 a year are more likely to be happy.";
    Pattern pattern = Pattern.compile("(?!\\s).+?(?:[!?]|$|(?:(?<!\\d)\\.(?!\\d)))");
    Matcher matcher = pattern.matcher(str);
    int count = 0;
    while (matcher.find()) {
    System.out.println("第" + ++count + "句:" + matcher.group(0));
    }
    }}
      

  3.   


    终于有人回复啦  
    我想说的是,他这题目的意思就是以句号、问号、叹号作为每句的结束符的,想要能正确匹配所有句子的话不容易哦,你想下,在一句话中会出现小数点的情况有多少种,我能想到的有 “Mr.”、“Ms.”、“A.M.”、“P.M.”、“George W. Bush”,还有很多我没想到,要想在这些情况也能使用,那就得找出它们的所有规则才行。我这里就当做是给个思路吧。