| 1 | pattern: "(?P<key>\\w+)=(?P<value>.*)" |
| 2 | |
| 3 | # Test various YAML multiline string formats |
| 4 | |
| 5 | inject: |
| 6 | # Literal style (preserves newlines and trailing spaces) |
| 7 | - key: LITERAL_STYLE |
| 8 | value: | |
| 9 | This is a literal style multi-line string. |
| 10 | It preserves newlines exactly as written. |
| 11 | Even trailing spaces are preserved. |
| 12 | |
| 13 | Empty lines are preserved too. |
| 14 | |
| 15 | # Folded style (folds newlines into spaces) |
| 16 | - key: FOLDED_STYLE |
| 17 | value: > |
| 18 | This is a folded style multi-line string. |
| 19 | Newlines are folded into spaces, |
| 20 | creating a single long line. |
| 21 | |
| 22 | But paragraph breaks (empty lines) are preserved. |
| 23 | |
| 24 | # Literal style with block chomping indicators |
| 25 | - key: LITERAL_STRIP |
| 26 | value: |- |
| 27 | This literal block strips |
| 28 | the final newline. |
| 29 | |
| 30 | - key: LITERAL_KEEP |
| 31 | value: |+ |
| 32 | This literal block keeps |
| 33 | all trailing newlines. |
| 34 | |
| 35 | |
| 36 | # Folded style with chomping |
| 37 | - key: FOLDED_STRIP |
| 38 | value: >- |
| 39 | This folded block strips |
| 40 | the final newline. |
| 41 | |
| 42 | - key: FOLDED_KEEP |
| 43 | value: >+ |
| 44 | This folded block keeps |
| 45 | all trailing newlines. |
| 46 | |
| 47 | |
| 48 | # Indentation indicators |
| 49 | - key: LITERAL_INDENT |
| 50 | value: |2 |
| 51 | This literal block |
| 52 | has explicit indentation |
| 53 | of 2 spaces. |
| 54 | |
| 55 | # Complex multi-line with special characters |
| 56 | - key: COMPLEX_MULTILINE |
| 57 | value: | |
| 58 | Line with "quotes" and 'apostrophes' |
| 59 | Line with \backslashes\ and /forward/slashes/ |
| 60 | Line with ${variables} and $(substitutions) |
| 61 | Line with special chars: @#$%^&*() |
| 62 | Unicode: αβγ 🚀 中文 |
| 63 | |
| 64 | rewrite: |
| 65 | # Multi-line patterns in rewrite rules |
| 66 | - key: MULTILINE_PATTERN |
| 67 | match: | |
| 68 | This will be treated as |
| 69 | a single line pattern |
| 70 | with spaces between. |
| 71 | value: "Matched multi-line" |
| 72 | |
| 73 | - key: MULTILINE_REPLACEMENT |
| 74 | match: "error" |
| 75 | value: | |
| 76 | ERROR DETECTED! |
| 77 | Please check the logs. |
| 78 | Contact support if needed. |
| 79 | |
| 80 | # Variable substitution in multi-line |
| 81 | - key: TEMPLATE |
| 82 | value: > |
| 83 | Error in ${key}: |
| 84 | Value was: ${value} |
| 85 | Time: ${timestamp} |
| 86 | Please investigate. |
| 87 | inject: yes |