I know that there are a lot of answers to vim/regex, but I can't seem to find one that fits the bill for me. So, I'm trying to remove some attributes from HTML using the following:
%s/( id="\| onfocus="\| onBlur="\| style="\| title=") [a-zA-Z0-9:;&$_\.\s\(\)\-\,]*"//gc
I'd like to be able to replace any of the specified attributes and everything up to and included the second =
.
When I run this, I get pattern not found
. However, if I take the parens off of id="\| onfocus="\| onBlur="\| style="\| title="
I get a match for id=
and I get a match for everything on title="hi"
How can I include all of the attributes in one regex?
Edit: A result of running
%s/ id="\| onfocus="\| onBlur="\| style="\| title=" [a-zA-Z0-9:;&$_\.\s\(\)\-\,]*"//gc
will change
<input type="submit" id="submit" title="submit" value="submit" />
To
<input type="submit" submit" value="submit" />
You can see it picks up the id=
but not the text and double quote after the attribute up to the next space. However, it is pattern matching the correct thing for the title
attribute. In this example title="submit"
has been fully removed.