Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何通过 match() 方法从字符串中提取句子?
示例: “等等……发生了什么事?……你怎么了……?-没什么。似乎我在说话……!-真的吗???-你打赌!”
回报: ["Wait...", "Whats happen?", "Whats wrong with you..?", "-Nothing.", "Seems i've speeking..!", "Realy???", "You bet!"]
["Wait...", "Whats happen?", "Whats wrong with you..?", "-Nothing.", "Seems i've speeking..!", "Realy???", "You bet!"]
str.match(/(.*?(?:\.|\?|!))(?: |$)/g)
http://jsfiddle.net/akXF3/