Page 1 of 1

Regex-Übereinstimmung zwischen bestimmten Tags

Posted: 16 Jan 2025, 11:39
by Guest
Ich versuche, Abschnitte eines benutzerdefinierten HTML-Dokuments zu extrahieren und zu ersetzen oder zu entfernen.

Code: Select all

stuff I want to keep

[i]@if includesDownloadables[/i]
This is some stuff I want to replace on a certain condition.
[i]@endif includesDownloadables[/i]

More stuff to keep

[i]@if instantDownload[/i]
More stuff that is conditional.
[i]@endif instantDownload[/i]

More stuff to keep

Ich habe auf regex101.com herumgespielt und selbst damit experimentiert:

Code: Select all

string condition = "includesDownloadables";
string pattern = @"