Timeline for Print content between first matching brackets
Current License: CC BY-SA 4.0
12 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jan 8, 2021 at 18:53 | vote | accept | GeoCap | ||
| Jan 8, 2021 at 18:40 | comment | added | Stéphane Chazelas | @GeoCap, see edit. | |
| Jan 8, 2021 at 18:39 | history | edited | Stéphane Chazelas | CC BY-SA 4.0 |
added 104 characters in body
|
| Jan 8, 2021 at 18:26 | comment | added | Ed Morton |
@GeoCap chameleon questions are strongly discouraged but please edit your question to show more truly representative sample input/output instead of adding requirements and other information in comments. FWIW I updated my answer to do a literal string match on START instead of a regexp match so it'll work no matter which characters it actually contains (except newline).
|
|
| Jan 8, 2021 at 18:17 | comment | added | GeoCap | Thanks, my last issue is that START can contain characters that need to be escaped, like START. I changed the code so I pass in a string /$VAR\s... is there a way to take the string in literal without needing to write STA*RT | |
| Jan 8, 2021 at 18:17 | comment | added | Ed Morton |
@StéphaneChazelas I suggested \s because GeoCap specifically said in their comment that the { could be on the line after START: "...first { could begin in a new line.".
|
|
| Jan 8, 2021 at 18:14 | comment | added | Stéphane Chazelas |
@EdMorton, I've now updated it, but used \h instead, for horizontal spacing only so excluding \r/\n... To avoid matching on START<newline>{...}. @GeoCap, replace with \s if that's actually what you want.
|
|
| Jan 8, 2021 at 18:12 | history | edited | Stéphane Chazelas | CC BY-SA 4.0 |
added 9 characters in body
|
| Jan 8, 2021 at 17:58 | comment | added | Ed Morton |
@GeoCap try changing START to START\s* in the regexp to allow for any optional white space between START and {.
|
|
| Jan 8, 2021 at 17:56 | comment | added | GeoCap |
Your solution does work, it's my fault that I forgot to add some details, such that first { could begin in a new line.
|
|
| Jan 8, 2021 at 17:31 | history | edited | Stéphane Chazelas | CC BY-SA 4.0 |
added 204 characters in body
|
| Jan 8, 2021 at 17:25 | history | answered | Stéphane Chazelas | CC BY-SA 4.0 |