D&C Lug - Home Page
Devon & Cornwall Linux Users' Group

[ Date Index ][ Thread Index ]
[ <= Previous by date / thread ] [ Next by date / thread => ]

[LUG] VIM regexp problem



Trying to get VIM to globally search for a value at the start of a line
and then replace other values later on in the line with the initial value.

simple mockup e.g.
  <var id="FOO" r="R0" g="G5" b="R2">

I want each line like this to be converted to:
  <var id="FOO" r="FOO" g="G5" b="FOO">

I've got as far as:

  :%g/<var id="\([0-9A-Z]]*\)"/ s/R[0-9]/\1/g

...but it isn't working :-(

The problem is that \1 isn't getting the pattern from the first regular
expression.

Anybody know how to get the second command to pick up the regexp from the
first?

Thanks in advance.
Jon

--
The Mailing List for the Devon & Cornwall LUG
Mail majordomo@xxxxxxxxxxxx with "unsubscribe list" in the
message body to unsubscribe.



Lynx friendly