I get that `attr{Start,End}Name` should be set back to false, but why change this condition and involve a regex?
What's wrong with using `lastIndexOf` here?

If this way is the way to go, then remove the `index` variable (L626) since it's no longer used, and also cache regex