I have plain text with some custom tags.
For example:
I like C#. <code lang="C#">public static void main</code>
THis is good language.
I need replace all whitespace that’s not inside a tag with
The text after replace must be:
I like C#. <code lang="C#">public static void main</code>
THis is good language.
If you have valid XML elements mixed with text, you can use XML parsing class, for instance XDocument, you can do it like this: