tags:

views:

41

answers:

3

Good day. Little question about reg exp.

I have a string look like

http://servercom/smth/Age=&Filter=2&

How can i cut & with regexp from url?

After regexp url-string must be http://server.com/smth/Age=1&Filter=2&

A: 

Oh. stackoverflow cutted my string

Age=&Filter=2&amp

need cut amp;

Edit your question instead of posting an answer
NullUserException
+5  A: 

You don't need regex for that:

changed = str.replace('&', '&');

http://docs.python.org/library/string.html#string.replace

NullUserException
A: 

You are translating XML escaped special characters. Use the standard lib:

>>> u = "http://servercom/smth/Age=&Filter=2&
>>> import xml.sax.saxutils
>>> xml.sax.saxutils.unescape(u)
'http://servercom/smth/Age=&Filter=2&'
Paul McGuire