К сожалению, мои навыки регулярных выражений очень плохи
Я хотел бы написать функцию, которая может удалить любую данную пару строк и все, что между ними
Например
It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as op<!--posed to using--> 'Content here, content here', making it look like readable English. Many desktop publishing packages <!--and web page<!-- asdasasdas--> editors now use--> Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
Из приведенного выше примера текста я хочу удалить эти пары строк и все, что внутри них <!--
-->
После удаления пример текста будет выглядеть следующим образом:
It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as op 'Content here, content here', making it look like readable English. Many desktop publishing packages Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
Есть ли любая готовая функция для этой задачи? Я не хочу указывать c регулярное выражение для этого
Это должна быть функция, которая принимает 3 параметра
параметр 1: текст
параметр 2: начальная часть пары строк, например, <!--
параметр 3: конечная часть пары строк, например, -->
Использование последних. net framework 4.8 +
edit
связанный ответ, например, терпит неудачу в этом
ing packages <!--and web page<!-- asdasasdas--> editors now use--> Lorem Ipsum
Более того, он также должен работать с многострочными
, такими как
ok like readable English. Many desktop publishing packages
<!--
and web page<!-- asdasasdas--> editors no
w use--> Lorem Ipsum as their de
станет
ok like readable English. Many desktop publishing packages
Lorem Ipsum as their de
здесь примером в коде
![enter image description here](https://i.stack.imgur.com/u8fdF.png)
здесь образцами. образец 4 в настоящее время не работает
https://dotnetfiddle.net/mA3waq