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, or e. You have to escape the [ as \[ to match an open-bracket character.
Put them together (and simplify {1,} to the shorthand +), and try this:
Regex.Replace(Comment, @"\[/quote\][\r\n]+", "[/quote]");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With