tags:

views:

61

answers:

1

I have an instance where certain URLs are getting malformed with equal signs and I need to be able to remove them.

An example broken URL:

http://www.go=ogle.com/search?ie=UTF

to be corrected to this:

http://www.google.com/search?ie=UTF

It can not simply replace the first occurrence of = because not all URLs are broken like this.

Is there a sed/awk or other regex way of deleting all instances of = only if they occur before a question mark?

A: 
mvds
worked perfectly, thanks
neurophobic
I would describe that differently, but that's pretty much what I would use. Didn't know you could use ~'s in place off / though. I would say that you 'replace any string starting with http://, ending with =, and having no ?'s with the original string, not including the =.'
Slartibartfast
@slartibartfast: I updated the answer to (almost) match your description ;-)
mvds
as for ~ and /, some (most?) regexp environments let you choose the delimiter on the fly.
mvds