INNER CODE UNIT · Python

is_regex_pattern

ArcSurge/Termius-Pro-zh_CN · lang.py:224

def is_regex_pattern(s):
    """判断是否为正则表达式模式(/pattern/ 格式,排除 // 注释)"""
    return len(s) > 1 and s.startswith("/") and s.endswith("/") and "//" not in s


def parse_replace_rule(rule):
    """解析替换规则:原字符串|新字符串

    使用 | 作为分隔符,最多分割一次以支持替换内容中包含 |
    """
    if "|" not in rule:
        raise ValueError("Invalid replacement rule format.")
    return rule.split("|", 1)


def get_asar_cmd():
    """根据操作系统返回 asar 命令

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…