Unfortunately my regex skills are very bad
I would like to code a function that can remove any given pair of strings and whatever between them
For example
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).
From this above example text, i want to remove these string pairs and whatever inside them <!--
-->
After removal the example text become as below
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).
Are there any readily function for this task? I don't want a specific regex for this
It should a function which takes 3 parameters
parameter 1 : the text
parameter 2 : the beginning part of string pair e.g. <!--
parameter 3 : the end part of string pair e.g. -->
Using latest .net framework 4.8+
edit
the linked answer for example fails at this
ing packages <!--and web page<!-- asdasasdas--> editors now use--> Lorem Ipsum
Moreover, it has to work with multi-line as well
such as
ok like readable English. Many desktop publishing packages
<!--
and web page<!-- asdasasdas--> editors no
w use--> Lorem Ipsum as their de
will become
ok like readable English. Many desktop publishing packages
Lorem Ipsum as their de
here example in code
here samples. sample 4 currently not working
https://dotnetfiddle.net/mA3waq
See Question&Answers more detail:
os