how to count Enter in a string?

.net, c#, regex, vb.net

Solution

Depending on the line break symbol used you may have to change to just `\r` or just `\n`.

var numberLineBreaks = Regex.Matches(input, @"\r\n").Count;

Problem

Possible Duplicate: How would you count occurences of a string within a string (C#)? I have a string that has multiple sub-strings and Enter (special character by pressing Enter key) between them. Can you please guide me how to write a regular expression that counts Enter keys between words ? Thanks

Original source

Related problems