Advertisement
kristina111

Untitled

Nov 8th, 2016
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function extractSent(input) {
  2.     let quer = input[0]
  3.     let text = input[1];
  4.     //const pattern = /(\w[^.!?]*)?\b/q+quer+/\b[^.!?]*[^.!?]/g;
  5.     let pat = new RegExp("(\\w[^.!?]*)?\\b"+quer+"\\b[^.!?]*[^.!?]", "g");
  6.     let matches = text.match(pat);
  7.     if(matches!=null){
  8.         for(let m of matches){
  9.             console.log(m.trim());
  10.         }
  11.     }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement