Multiline regular expression in C#

Viewed 42797

How do I match and replace text using regular expressions in multiline mode?

I know the RegexOptions.Multiline option, but what is the best way to specify match all with the new line characters in C#?

Input:

<tag name="abc">this
is
a
text</tag>

Output:

[tag name="abc"]this
is
a
test
[/tag]

Aahh, I found the actual problem. '&' and ';' in Regex are matching text in a single line, while the same need to be escaped in the Regex to work in cases where there are new lines also.

2 Answers
Related