I want to export a View as a HTML-Document to the User on my ASP.NET page. I want to give the option to only get a part of the view.
Because of that I want to split the output with
Regex.Split(). I wrote a Regex that matches the part I want to cut out. After splitting I put the 2 output parts together again.
The problem is that I get a list of 3 parts, of which the second contains
" ". How can I change the code that the output contains only 2 strings?
textParts = Regex.Split(text, @"<!--Graphic2-->(.|\n)*<!--EndDiscarded-->"); text = textParts + textParts;
text contains HTML, CSS and jQuery Code. I wrote comments like
<!--Graphic2--> around the blocks I want to cut out.
I got it working now by using the
Regex.Replace() Method. But I still don't know why
Split isn't working how I expected.