I have to find particular phrase (e.g. <h3 id=“top”>) which includes spaces, <, “, etc.
and replace it with another phrase
(e.g. <a class"top” href="…/file/file.xhtml>), also with spaces and other ‘characters’.
It certainly is the / (it is a “slash” not a “backslash”). And you can avoid that by using another character instead of all three / that are relevant to the s command. One that does not appear anywhere in both strings. The % for example. Remember that the fisrt character after the s defines what you should use to delimiter both strings.
I agree that using a \ before characters in the REGEXP and/or the REPLACEMENT that are the same as the delimiter character, should help also (but I still think using a different delimiter is easier to type and read), but why does he then say:
I discovered that problem is “backslash /” in the expression.
I solved the problem using , (comma) as a delimiter. Then I could f&r whatever I wanted (fortunately there were no commas in my expression )
Some explanations:
I had problem with / (slash) because it was used as a delimiter and character in my expression - that’s why it caused problems.
I didn’t know (prior) that first letter after 's is delimiter. Most examples are with / as a delimiter. Thanks to hcvv and his explanation on delimiter, plus few examples on the net, I tried to use comma and it worked!
So for me for now the problem is solved.
Thanks everyone.
That is fine. I often use % because that is even less used in many cases then , .
And yes, the / is allmost allways ussed (and is more or less automaticly used by my fingers when I am using vi), but one should llways use the documentation (hehe).