Regular Expression for the special character "|" pipe

Aman Kashyap amankashyap1223 at gmail.com
Tue May 27 06:59:48 EDT 2014


I would like to create a regular expression in which i can match the "|" special character too.

e.g.

start=|ID=ter54rt543d|SID=ter54rt543d|end=|

I want to only |ID=ter54rt543d| from the above string but i am unable to write the  pattern match containing "|" pipe too.

By default python treat "|" as an OR operator.

But in my case I want to use to as a part of search string.



More information about the Python-list mailing list