perf: 优化正则匹配

pull/10722/head
ibuler 2023-06-14 20:39:03 +08:00 committed by Jiangjie.Bai
parent d10db0aa62
commit 25e7249957
1 changed files with 1 additions and 1 deletions

View File

@ -474,7 +474,7 @@ class JSONManyToManyDescriptor:
res &= str(value).endswith(str(rule_value)) res &= str(value).endswith(str(rule_value))
elif rule_match == 'regex': elif rule_match == 'regex':
try: try:
matched = bool(re.match(rule_value, value)) matched = bool(re.search(r'{}'.format(rule_value), value))
except Exception as e: except Exception as e:
logging.error('Error regex match: %s', e) logging.error('Error regex match: %s', e)
matched = False matched = False