[ILUG] [OTish] Regex question...

Stephen Shirley diamond at csn.ul.ie
Mon Jan 7 18:01:52 GMT 2002


Mornin',
	Say you were porting some files from dos to linux (woe is me),
and you wanted to run a searh+replace in vi (or sed, or awk or 
*shudder* emacs) to convert

#include "foo\bar\apples.h"
	
	to

#include "foo/bar/apples.h"

Now the best i can come up with is this (in vi):
%s/\(#include[^"]*"\)\([^\\]*\)\\\(.*\)/\1\2\/\3/cg

but that will only match and convert the first \. How do I get a regex
to match all the \'s in the line? 

Steve
-- 
"My mom had Windows at work and it hurt her eyes real bad"




More information about the ILUG mailing list