How to make a regex pattern? Python

Question:

...id|123|...

I need to get the id value. I tried:

print(re.search('id|(.*?)|', str)

but it printed a space

Asked By: xss1de

||

Answers:

"|" in regular expression means "either or"

"|" searches for the character "|"

try 'id|(.*?)|'

Answered By: ACA
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.