1

Taking this text as exemple:

Lorem ipsum dolor, sit START amet consectetur adipisicing elit.
Doloribus, aspernatur! Illum id sapiente STOP eligendi, autem,
consequuntur START asperiores illo atque aut, incidunt quia numquam
beatae esse hic dolor odit minus STOP iure!

I try to capture and replace the text located between START and STOP word, which may contains new lines.

I've read VS code uses Rust flavor or Javascript flavor for regex, so I tried both:

START((?s:.*?))STOP

and

START([^]*?)STOP

but none of them is working (whereas they works well with online regex testers). First one is considered as invalid, and second one returns no result.

Which regular expression should I use to achieve this?

Thank you!

Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563
Julien
  • 66
  • 4

1 Answers1

1

Use [\w\W] to match any character including newline. Your regex becomes:

START([\w\W]+?)STOP

Screenshot:

enter image description here

Toto
  • 89,455
  • 62
  • 89
  • 125