We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9c3e674 commit 63d3528Copy full SHA for 63d3528
skrules/rule.py
@@ -1,6 +1,11 @@
1
+import re
2
+
3
def replace_feature_name(rule, replace_dict):
- for key, value in replace_dict.items():
- rule = rule.replace(key, value)
4
+ def replace(match):
5
+ return replace_dict[match.group(0)]
6
7
+ rule = re.sub('|'.join(r'\b%s\b' % re.escape(s) for s in replace_dict),
8
+ replace, rule)
9
return rule
10
11
class Rule:
0 commit comments