I am trying to count all of the words in a richtextbox via regex.Matches. Right now I am using "\w+", but that matches words with apostrophe's twice (ex. he's). Is this possible?
\w is equivalent (in English cultures) to [a-zA-Z_0-9] and so doesn't include the apostrophe. So, if you want to regard the apostrophe as being part of the word you'll need to replace \w with [a-zA-Z_0-9'] You might also want to include the hyphen between the [] as well.
1 answers
\w is equivalent (in English cultures) to [a-zA-Z_0-9] and so doesn't include the apostrophe.
So, if you want to regard the apostrophe as being part of the word you'll need to replace \w with [a-zA-Z_0-9']
You might also want to include the hyphen between the [] as well.
answered 2 years ago by:
17279
This post was imported from csharpfriends, if you have a similiar question please ask it again.
All previous members have been migrated, hope you enjoy the new platform!