I am trying to do a search and replace on a large database file where some of the urls are escaped and some not, e.g.:http://www.example.comhttp:\\/\\/www.example.comI thought I could use a simple character class in a regex like this:%s~http\(:[/\\]+www.example.com\)~https\1~gBut won't work no matter how I escape it.  Can I use character classes in vim search and replace?  If not, how can I match the url so that any amount of backslashes and forward slashes are matched?
replacing urls and escaped urls
regular expression;substitute
In your search pattern of the :s part you are looking for www. which is not part of your source. So it won't match. Better would be to make that part optionally:%s~http\(:[/\\]\+\(www.\)\?example.com\)~https\1~gor even better: %s~http:[/\\]\+\(\(www.\)\?example.com\)~https://\1~gwhich will also normalize the slashes following the protocol part of your URI.