ok i have a file that may or may not be newlined or carriage fed. frankly i need to ignore that. I need to search the document find all the < and matching > tags and remove everything inside them. I’ve been trying to get this to work for a bit my current regex is:
private Regex BracketBlockRegex = new Regex("<.*>", RegexOptions.Singleline);
....
resultstring = BracketBlockRegex.Replace(filecontents, "");
but this doesn’t seem to be working because it catches WAY to much. any clues? is there something wierd with the < and > symbols in c#?
Try a non-greedy variant of your regex:
What you have,
<.*>, will match the first<followed by everything up to the last>, whereas what you want is to match to the first one.