fork download
  1. var re = /([^?.]+[?.])(?:\s|$)/g;
  2. var str = 'This is sentence 1. This is sentence 2? This is sentence 3.';
  3. var m;
  4.  
  5. while ((m = re.exec(str)) !== null) {
  6. print(m[1]);
  7. }
Success #stdin #stdout 0.4s 321920KB
stdin
Standard input is empty
stdout
This is sentence 1.
This is sentence 2?
This is sentence 3.