Edit: with the new information, the following substitution is likely to work:
:%s/<filename>\zs.\{-}\ze<\/filename>/\=substitute(submatch(0), '\/', '\', 'g')/
Explaination:
%s : replace with whole file/<filename> : start of pattern and static text to match\zs : start of matching text.\{-} : any character that is not greedy\ze : end of matching text<\/filename>/ : end of target tag and template\= : evaluate the replacement as a vim expressionsubstitute(submatch(0), '\/', '\', 'g')/ : replace all / with \ in the matched text.
Original answer:
I'm going to suggest that you mean XML style tags. What I would do is visually select the area in which you want to work, and then use the regex atom \%V to work only with that choice.
vit:s!\%V/!\\!g
Gotta do the trick. Note that when pressed : vim will automatically add a range for visual selection, the actual substitution command will look like this:
:'<,'>s!\%V/!\\!g
Randy morris
source share