I am new to Regex. There is data in the format of "(ENTITY A)-[:RELATION {}]->(ENTITY B)", for example, (Canberra)-[:capital_of {}]->(Australia). How can I extract two entities and the relation?
I have tried the following code:
path = "(Canberra)-[:capital_of {}]->(Australia)"
pattern = r'\(.*\)\-\[\:.*\]\-\>\(.*\)'
re.match(pattern,path).group()
But it matches the whole sentence. Any help would be appreciated.