Tobia wrote on 02/04/2007 23:51: > 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 Thanks that is exactly what I expect: it works for all values listed in foo attribute. I don't need to repeat the command. Good lesson for me today: keep it simple ;-) > > >> 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 >
-- Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird