Regular Expressions 101

Community Patterns

Community Library Entry

3

Regular Expression
ECMAScript (JavaScript)

/
\.(?!html?)([a-z]{0,3}|[a-z]{0,4})$
/
gm

Description

Allow you to check if the JavaScript location.pathname is a link required adding a target="_blank".

Submitted by Bruno Lesieur - 10 years ago