Commit 0b784f1b by 陈森彬

优化匹配正则

parent 57478123
Showing with 2 additions and 1 deletions
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
import re import re
from config import unit_map, cast_map, unit_regex from config import unit_map, cast_map, unit_regex
unit_pattern = re.compile('(\d+|\d+[\\\./]\d+)(' + unit_regex + ')') unit_pattern = re.compile('(\d+|\d+[\\\./]\d+)(' + unit_regex + ')([.*a-zA-Z]?)')
def is_float(s): def is_float(s):
...@@ -60,6 +60,7 @@ def check_param(kw): ...@@ -60,6 +60,7 @@ def check_param(kw):
else: else:
new_list = [] new_list = []
for param in check_res: for param in check_res:
if not param[2].isalpha():
new_list.append(param[0] + param[1]) new_list.append(param[0] + param[1])
check_res = new_list check_res = new_list
return check_res return check_res
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment