The YAML spec says that in block scalars, both indicators can appear in any order.
This is the case since YAML 1.0: https://yaml.org/spec/1.0/index.html#id2566934
# Modifiers may be combined in any order.
indented and chomped: |2-
This has no newline.
also written as: |-2
This has no newline.
both are equal to: " This has no newline."
Also on latest YAML 1.2.2: https://yaml.org/spec/1.2.2/#rule-c-b-block-header
[162] c-b-block-header(t) ::=
(
(
c-indentation-indicator
c-chomping-indicator(t)
)
| (
c-chomping-indicator(t)
c-indentation-indicator
)
)
s-b-comment
But the grammar only allows the number before the chomping indicator:
https://github.com/textmate/yaml.tmbundle/blob/master/Syntaxes/YAML.tmLanguage#L217
(?:(\|)|(>))([1-9])?([-+])?(.*\n?)
Example:
should-work1: |+2
string
should-work2: >+2
string
should-work3: |-2
string
should-work4: >-2
string
works1: |2+
string
works2: >2+
string
works3: |2-
string
works4: >2-
string