Click here to Skip to main content
15,887,214 members
Articles / General Programming / Regular Expressions

Don't count spaces when counting words.

Rate me:
Please Sign up or sign in to vote.
5.00/5 (7 votes)
18 Oct 2011CPOL 9.2K   2  
The Regex method uses comma, full stop, hyphen, and apostrophe as word separators. The problem with this is that these characters are not universally used as separators. The hyphen is used to join two words. Could I suggest the following?string input = "Mr O'Brien-Smith arrived at 8.30 and...

Views

Daily Counts

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Student
Wales Wales
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions