I’ve been trying to match something like this
mystring = "kdjf4kf., kfg. (KFJG)"
regex = r'.+\(\w+\)'
But it is not working, it does not find anything. I would like to extrapolate KFJG. How can I do it?
Example:
>>> a = "Amazon (AMZN)"
>>> regex = '.?(\w+)'
>>> match = re.match(regex, a)
>>> match.group(0)
'Amazon'
>>> match.group(1)
'mazon'
Because you forgot to include the match inside a capturing group