I have a string \"Name(something)\" and I am trying to extract the portion of the string within the parentheses!
Iv\'e tried the following solutions but don\'t seem
You can use re.match:
re.match
>>> import re >>> s = "name(something)" >>> na, so = re.match(r"(.*)\((.*)\)" ,s).groups() >>> na, so ('name', 'something')
that matches two (.*) which means anything, where the second is between parentheses \( & \).
(.*)
\(
\)