Reputation: 107
I have string like this,
filter = "emails.type==\"work\""
The regexp i have written to group different things,
matchobj = re.search(r"(\w+)(\.)?(\w+)?(==|!=|(like|LIKE))(.*[^\\])", filter)
testing,
print("group1 ", matchobj.group(1))
print("group2 ", matchobj.group(2))
print("group3 ", matchobj.group(3))
print("group4 ", matchobj.group(4))
print("group5 ", matchobj.group(5))
result,
group1 emails
group2 .
group3 type
group4 ==
group5 None
The issue is with group 5, which is returning None and expected value for group 5 is "work" with quotes.
Upvotes: 0
Views: 26