(?x:
  %
  (?=
    # anything but no colon, percentage or command terminator char
    ( [^:%[|&<>]]
    # otherwise must not look like followed by a command
    | [[|&<>]](?!\s*\w+[\s[|&<>]])
    )+
    # don't check substrings and substitutions
    (:~?[^%]*)? %
  )
)