i need help with vim and regex.
i have a html file with a lot of class="..."
e.g.
<td class="td_3"><p class="block_3">80 €</p></td>
<td class="td_3"><p class="block_3">90 €</p></td>
Since i'm not using any css, i want to delete them. i tried:
:%s/class="[a-z0-9]"//g
but it's not working. What am i doing wrong?
With class="[a-z0-9]"
pattern, you match a single alphanumeric char in between quotes, while there may be any text other than double quotation mark.
You probably also want to remove the whitespaces before the class
.
You may use
:%s/\s\+class="[^"]*"//g
Here, \s\+
will match one or more whitespace chars, class="
matches a literal string, then [^"]*
finds any zero or more chars other than "
as many as possible and then a "
matches the closing double quotation mark.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With