Reputation: 509
I need to find a carriage return (\r) that doesn't have a line feed (\n) directly after it how would I do this with a regex pattern?
Upvotes: 9
Views: 6188
Reputation: 6515
This should do the trick:
Regex.Match("\rtext\r\ntext.", "\r[^\n]", RegexOptions.Multiline);
Upvotes: 1
Reputation: 39207
What about the following regex with a negative lookahead:
\r(?!\n)
Upvotes: 11