0

I have some file in mht format. On part HTML i do replace on regex.

string reta = Regex.Replace(_file, @"\<![ \r\n\t]*(--([^\-]|[\r\n]|-[^\-])*--[ \r\n\t]*)\>",
                            String.Empty, RegexOptions.Singleline | RegexOptions.Multiline |
                            RegexOptions.IgnorePatternWhitespace);

And for something file this replace never stop.
Maybe you can see something wrong in this replace. I don't add this file because preserve data.

Thanx

PS. I try select out this part.

ANSWER
I changed the query REGEX in the test data set is working.

<![ \r\n\t]*--.*?--[ \r\n\t]*>
Rafal T
  • 339
  • 1
  • 2
  • 14
  • "something file"? No, sorry, you'll have to provide some source. Make a minimal case, that is, the smallest file that the problem occurs for. – Mr Lister Jan 04 '12 at 08:01

1 Answers1

1

When ever someone posts a question about regex and html I say look at this answer first:

RegEx match open tags except XHTML self-contained tags

You need to read it.

Community
  • 1
  • 1
Richard
  • 21,728
  • 13
  • 62
  • 101