如何在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时出错:扫描简单键时
以及以下行中的{{1}}:
找不到预期的':'
答案 0 :(得分:1)
正则表达式需要进一步缩进:
patterns:
- match: |
(?x) # Ignore Comments
% # % Escape Character
[#0\- +]* # Prefix and Alignment Flags
\d* # Minimum field width
(\.\d+)? # Maximum precision
[diouxXCcsp%] # Conversion type