Is there any way to exucute regex string as a code.
import re
list1 = ["guru99 get", "guru99 give", "guru Selenium"]
for element in list1:
z = """re.match("(g\w+)\W(g\w+)", element)""" ##this needs to be in string as i am taking from file.
if z:
print((z.groups()))
Error:
Traceback (most recent call last):
File "/u/vithals/Desktop/Waver/regex_worked.py", line 7, in <module>
print((z.groups()))
AttributeError: 'str' object has no attribute 'groups'