Files
aaPanel/class/public/regexplib.py
T
Jack a24f2e23c6 Update to 7.25.0
1. Added Mail Marketing Automation trigger tasks
2. Added Mail Marketing Groups Import, Export, Merge
3. Added Mail Marketing Subscribers to support paste import
4. Added Mail Marketing Template Import Export Duplicate
5. Added Mail server add timed automatic reply
6. Added HTTPS Protection function for Website (disables automatic HTTP to HTTPS redirection when enabled)
7. Optimize Website Interface Button Integration
8. Optimize the response speed of WP Toolkit interface
2025-03-13 17:52:26 +08:00

36 lines
1.6 KiB
Python

import re
# 匹配IP地址
match_ipv4 = re.compile(r'^(?:(?:25[0-5]|(?:2[0-4]|1?\d)?\d)\.){3}(?:25[0-5]|(?:2[0-4]|1?\d)?\d)$')
match_ipv6 = re.compile(r'^(?:(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4})|(?:(?:[0-9a-fA-F]{1,4}:){1,7}:)|(?:(?:[0-9a-fA-F]{1,4}:){6}:[0-9a-fA-F]{1,4})|(?:(?:[0-9a-fA-F]{1,4}:){5}(?::[0-9a-fA-F]{1,4}){1,2})|(?:(?:[0-9a-fA-F]{1,4}:){4}(?::[0-9a-fA-F]{1,4}){1,3})|(?:(?:[0-9a-fA-F]{1,4}:){3}(?::[0-9a-fA-F]{1,4}){1,4})|(?:(?:[0-9a-fA-F]{1,4}:){2}(?::[0-9a-fA-F]{1,4}){1,5})|(?:(?:[0-9a-fA-F]{1,4}:){1}(?::[0-9a-fA-F]{1,4}){1,6})|(?::(?:(?::[0-9a-fA-F]{1,4}){1,7}|:))')
# 安全文件路径
match_safe_path = re.compile(r'^[\w\s./\-]*$')
# 匹配类私有属性名称
match_class_private_property = re.compile(r'^(?:_\w+)?__\w+')
# HOST基本格式
match_based_host = re.compile(r'^[\w.:\-]+$')
# 抓取URL根路径
find_url_root = re.compile(r'(https|http)://([\w:.\-]+)', re.IGNORECASE)
# 匹配首条PHP Fatal error信息
search_php_first_fatal_error = re.compile(r'PHP Fatal error: \s*([^\r\n]+)')
# 匹配HTTP响应报文中的状态行 (Status Line)
search_http_response_status_line = re.compile(r'HTTP/\d+(?:\.\d+)? (\d{1,3}) .*')
# 通用版本号格式验证 major.minor[.patch]/主版本.子版本[.修订号]
match_general_version_format = re.compile(r'^\d+(?:\.\d+){1,2}$')
# md5格式验证
match_md5_format = re.compile(r'^[a-fA-F0-9]{32}$')
# SQL字符串中的常用特殊字符
search_sql_special_chars = re.compile(r'''(?<!\\)(?:[%_]|\\(?![^\\abfnrtvxuUN'"0-7]))''')
# 匹配Email
match_email = re.compile(r'^.+@(\[?)[a-zA-Z0-9\-_.]+\.(?:[a-zA-Z]{2,}|\d{1,3})\1$')