如何在 YAML 中插入多行自由空间正则表达式?
patterns:
- match: |
(?x) # Ignore Comments
% # % Escape Character
[#0- +]* # Prefix and Alignment Flags
d* # Minimum field width
(.d+)? # Maximum precision
[diouxXCcsp%] # Conversion type
解析器在(?x)
的第一(
失败,并显示:
解析 YAML 时出错:扫描简单密钥时
以及以下行的%
:
找不到预期的":"
正则表达式需要进一步缩进:
patterns:
- match: |
(?x) # Ignore Comments
% # % Escape Character
[#0- +]* # Prefix and Alignment Flags
d* # Minimum field width
(.d+)? # Maximum precision
[diouxXCcsp%] # Conversion type