In a code editor like VS Code, search for:

(<img\b(?![^>]*\bloading\s*=))([^>]*)(>)

This finds <img> tags missing loading="lazy". You can then add loading="lazy" manually or in bulk.

To do it in bulk, toggle replace on VS Code, then paste this replace regex

$1 loading="lazy"$2$3

Explanation:

  1. (<img\b(?![^>]*\bloading\s*=)) matches <img only if it does not already have a loading attribute
  2. ([^>]*) matches everything inside the tag
  3. (>) matches the closing > of the tag
  4. $1 loading="lazy"$2$3 inserts loading="lazy" right after <img, keeping all other attributes intact.