I’m trying to remove any new line characters after [/quote]
I have this currently:
Comment = Regex.Replace(Comment, @"[/quote](\n){1,}", "[/quote]");
But it doesn’t seem to do anything!
Example:
[/quote]
hey nice quote blah blah
Goes to
[/quote]hey nice quote blah blah
Are you sure your string ends with
\n(UNIX-style line ending), and not\r\n(Windows-style line ending)?Also, realize that
[...]in a regex indicates a character class, so your[/quote]matches a single character that is either/,q,u,o,t, ore. You have to escape the[as\[to match an open-bracket character.Put them together (and simplify
{1,}to the shorthand+), and try this: