javascript - JS regex for match sentence -


i'm not able create regex correctly match single sentences in text javascript. i've used /([!?.:])\s+/g doesn't match correct sentence in long sequence.

for example

[1](i have received big present!) [2](you know?) [3](it's, really, car.) [4](the car have: blue color)  [5](it's hardly drive.) 

total senctences: 5 can correct regex match sentence?

edit:

i've numbered sentences. want match single sentence separated . or \n\n or \n or ! etc.

try following this

var str='this pen. boy';  var res= str.split(/[\.\!]+\s*|\n+\s*/);  //this code return array of sentense.  alert(res);  console.log(res);


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -