I have a css file in which a class name appears multiple times. Call it .foo The same name also appears in the file as foo and #foo
I'm trying to create a JavaScript regular expression that can match the css class .foo but disregard the other variations foo and #foo.
So far I've tried the following variations without success:
css.replace(/.foo/g,"")
css.replace(/^.foo/g,"")
css.replace(/^.foo*/g,"")
css.replace(/\b.foo/g,"")
css.replace(/.foo\b/g,"")
.in regex means "any character". Escape it..fooword such as in an image URL in the CSS file? replacing like this is too dangerous.css.replace(/\.foo(?=[^{]*\{)/g,"")