Bob Hiestand wrote:
> Tobia wrote:
> > Arnaud Bourree wrote:
> > > I've Xml document with attribute likes:
> > > foo="00 12 AF"
> > > I want to replace with:
> > > foo="0x00 0x12 0xAF"
> >
> > this works:
> >
> > %s/\%(\%(foo=\"\)\@<=\%([0-9A-F]\{2\}\s\)*\)\@<=\([0-9A-F]\{2\}\)/0x\1/g
>
> In using :s with the /g flag, I take it the potential changes are
> marked first, and then executed, per line?

It would seem so.

By the way, I would have used a simpler pattern for such a task:

%s/\v%(foo\="[^"]*)@<=(<\x\x>)/0x\1/g


> I prefer when dealing with that many special characters to use the
> very-magic form

Me too.  I can't stand trying to match \( \) with my eyes, they just
don't look right, not to mention \{ \? \+...  Egrep and Perl have it
right.  I wish I could turn very-magic on by default.


Tobia

Reply via email to