Have been looking all over the place for this. Suppose I have a block of XML like this:
<leftcol>
<block icon="tips" text="Is it right for you?" url="/support/feasibility.html" link="Feasibility evaluation"/>
<block icon="question" text="Interested?" url="/support/question.html" link="Ask a question"/>
<block icon="docs" text="Want some details?" url="/docs/" link="View documentation"/>
<block icon="box" text="Like It?" url="/purchase.html" link="Purchase online"/>
</leftcol>
And I want to use Vim to quickly jump to (or delete) attributes and their values. What would be a good regex to do this?
I tried the obvious / .*=".*?" but it’s too greedy — if I have two attributes on the same line, it selects them both.
Any help would be much appreciated. I’m specifically looking for a regex and not a plugin.
In vim non-greedy operator is
\{-}threfore you can search on:to match LHS of each and every attribute.
UPDATE: Based on OP’s comments below:
Use following non-greedy search pattern to search/match an attribute completely assuming
"has been used everywhere on RHS of an attribute:To move your cursor to the beginning of a search pattern use:
To move your cursor to the end of a search pattern use:
And finally to delete entire search pattern use: