Hi everyone,

I have a point of interest question about a substitution I was trying to make. At some points in my code I had a variable that was a pointer that was denoted (in C) by:

*iterNum

I wanted to replace instances of exactly this string globally between my present position and line 791, with:

j

therefore I tried the command below:

:.,791s/\<\*iterNum\>/j/g

and got the following error, even though the string

*iterNum

appeared a number of times within this range:

E486: Pattern not found: \<\*iterNum\>

I was fairly certain that the * had to be escaped, but just in case I tried the below:

:.,791s/\<*iterNum\>/j/g

and not surprisingly got an two errors, as follows:

E56: * operand could be empty
E476: Invalid command

So, in the end I gave up with the identical match and instead just used the following and checked it afterwards, I could of course have used c on the end as well to prompt me each time:

:.,791s/\*iterNum/j/g

My question (sorry this is so long-winded) is why the first substition did not work.

Many thanks,
Rob.

Reply via email to