我们可以使用被忽略的空格/换行符格式化 std::regex 字符串吗?只是为了更好地阅读?是否有任何可用的选项,如Python VERBOSE)?
不冗长:
charref = re.compile("&#(0[0-7]+"
"|[0-9]+"
"|x[0-9a-fA-F]+);")
详细:
charref = re.compile(r"""
&[#] # Start of a numeric entity reference
(
0[0-7]+ # Octal form
| [0-9]+ # Decimal form
| x[0-9a-fA-F]+ # Hexadecimal form
)
; # Trailing semicolon
""", re.VERBOSE)