Reputation: 1015
I'm using the following regex:
documentText = Regex.Replace(documentText, "\\\\|\\^|\\+|\\*|~|#|=|\"", "");
and it works. But when I split this string by using:
wordsInText = documentText.ToLower().Split(' ').ToList();
I get elements that are marked as ""
(empty string). I can remove it manually by iterating through collection and removing empty elements, but it must be a way to prevent this weird behaviour.
Upvotes: 1
Views: 128
Reputation: 116108
documentText.ToLower().Split(new char[]{' '},StringSplitOptions.RemoveEmptyEntries)
Upvotes: 1