I am trying to parse the string enclosed in single quotes.
For Input: Redditor(user_name='abc')
My Output should be: abc
This is working as expected:
text = "Redditor(user_name='abc')"
author = re.findall(r'\'(.+?)\'', text)
print(author)
This isn't:
text = str(x.author) #I am getting x.author from API call. If I print x.author then it displays Redditor(user_name='abc') on the console so this is correct
author = re.findall(r'\'(.+?)\'', text)
print(author) #finds no match
Any ideas why it isn't working?