mirror of https://github.com/jumpserver/jumpserver
perf: 优化正则匹配
parent
d10db0aa62
commit
25e7249957
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue