- 
      
- 
        Save kezenwa/9a0c4bddb63dff4515ae2dbac222b057 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | var striptags = require('striptags') | |
| function smartExcerpt (string) { | |
| var re = /(^.*?[a-zA-Z0-9\)\”\"]{2,}[.!?])[\s\”\"]+\W*[A-Z]/ | |
| var matches = striptags(string).match(re) | |
| return matches && matches[1] ? matches[1] : string | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment