正则表达式笔记
基本用法
实际场景
匹配以字符串2025-03-21开头, 以字符串update.sh结尾的行
2025-03-21.*?update\.sh
跨行匹配以字符串com.domain.exception开头, 以[na:na]结尾的字符串
(?s)com\.domain\.exception.*?\[na:na\]
其中 (?s)表示单行模式, enables single-line mode (also known as DOTALL mode), which makes the . character match newline characters as well. This allows the regex to span multiple lines.
浙公网安备 33010602011771号