Regular Expressions 101

Community Patterns

Non greedy Quotes JS

1

Regular Expression
ECMAScript (JavaScript)

/
([^\n<”]*?)|([^\n<’]*?)|(?:^|[^="])("[^="\n<"]*?")|('(?!(s|t|ll|d|m|ve|re)\s)[^\n<]*?')(?!(s|t|ll|d|m|ve|re))
/
ig

Description

Matches 4 different types of quoted text avoiding html element and element attributes. Single quotes allow for contractions withing the quotes.

Submitted by Shadi Lahham - 8 years ago