From 1a58385c88ee7abe94f60f7d00175a34e1bfa7bd Mon Sep 17 00:00:00 2001 From: Alessandro Berti Date: Sun, 1 Dec 2024 08:54:07 +0100 Subject: [PATCH] backport regex patch --- pm4py/algo/filtering/common/traces/infix_to_regex.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pm4py/algo/filtering/common/traces/infix_to_regex.py b/pm4py/algo/filtering/common/traces/infix_to_regex.py index 385547c0a..a8b43ca4d 100644 --- a/pm4py/algo/filtering/common/traces/infix_to_regex.py +++ b/pm4py/algo/filtering/common/traces/infix_to_regex.py @@ -1,3 +1,5 @@ +from re import escape + def translate_infix_to_regex(infix): regex = "^" for i, act in enumerate(infix): @@ -8,6 +10,9 @@ def translate_infix_to_regex(infix): else: regex = f"{regex}([^,]*,)*" else: + if act: + act = escape(act) + if is_last_activity: regex = f"{regex}{act}" else: