Fix Python – Regular expression to return text between parenthesis

Question

Asked By – user469652

u'abcde(date=\'2/xc2/xb2\',time=\'/case/test.png\')'

All I need is the contents inside the parenthesis.

Now we will see solution for issue: Regular expression to return text between parenthesis


Answer

If your problem is really just this simple, you don’t need regex:

s[s.find("(")+1:s.find(")")]

This question is answered By – tkerwin

This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0