Regular Expressions 101

Find image html tags without alternative text

Open Workspace
  • PCRE2 (PHP)
  • Match
1

Regular Expression

/
(<img(?!.*?alt=(['"]).*?\2)[^>]*)(>)
/
gm

Description

This regex finds images html tags without alternative text

Submitted by Anonymous