First Sentence Regex

前端 未结 7 2092
遇见更好的自我
遇见更好的自我 2021-01-20 03:54

I\'m after a regex ( php / perl compatible ) to get the first sentence out of some text. I realize this could get huge if covering every case, but just after something that

7条回答
  •  青春惊慌失措
    2021-01-20 04:14

    If sentence is "line" then simply match the first ^.* from a chunk of text. By default the DOT does not match new line characters.

    If it's really the first sentence, do something like this: ^[^.!?]*

提交回复
热议问题