Regular Expression To Match IMG Tag Without Forward Slash

A Regular Expression to match all <img> tags without forward slash (/).

/<img([^>]*[^/])>/

Matches:

  • <img src=”/path/to/image”>

Non-matches:

  • <img src=”/path/to/image” />
Regex Is Copied!