-2

I am trying to match everything between

/* and */

And also include the in between characters.

I currently managed to create a pattern that kind of does this

\/\*(.+?)\*\/

Regex Tester

But it doesn't match multi line quotes and only matches once.

enter image description here

How can I improve this pattern to match everything that starts with /* and ends with */ ?

UnknownUser
  • 327
  • 2
  • 14

1 Answers1

0

You need the RegexOptions.Singleline option, which makes the . match newlines.

Regex rx = new Regex("/\*(.+?)\*/", RegexOptions.Singleline);
Toto
  • 89,455
  • 62
  • 89
  • 125