Regular Expressions 101

Community Patterns

Match all words starting with "a" not in a Tag

1

Regular Expression
ECMAScript (JavaScript)

/
((?<!<[^>]*)|(?![^<]*>))((?<=^|\W)(a))
/
g

Description

Match all words that are not in a tag. Non-matching < and > do not prevent matches. But fails to match terms between < and > if no intervening < or >

Submitted by Michael Chambers - 3 years ago