chore: enhance re_findall function to handle None and empty string patterns
parent
0b72c5d4c2
commit
f3ef42b76f
|
|
@ -169,7 +169,12 @@ def parse_level(text, pattern: str):
|
||||||
|
|
||||||
|
|
||||||
def re_findall(pattern, text):
|
def re_findall(pattern, text):
|
||||||
if not pattern or not pattern.strip():
|
# 检查 pattern 是否为空或无效
|
||||||
|
if pattern is None:
|
||||||
|
return []
|
||||||
|
|
||||||
|
# 如果是字符串类型,检查是否为空字符串
|
||||||
|
if isinstance(pattern, str) and (not pattern or not pattern.strip()):
|
||||||
return []
|
return []
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue