IN
MatchCollection matches = Regex.Matches(input, @"\b[\w']*\b");
the code uses a regular expression that will search for any word; \ b means the word boundary, and \ w is the POSIX alpha-numeric class to get everything as letters (with or without graphic accents), numbers, and sometimes underlining, and "just included in the list along with alphaNum. So image, basically it is a search for the beginning and end of the word and its choice.
then
var words = from m in matches.Cast<Match>() where !string.IsNullOrEmpty(m.Value) select TrimSuffix(m.Value);
is LINQ syntax where you can execute SQL-Like queries inside your code. This code gets each match from the regular expression and checks to see if the value is empty and get it without spaces. It can also add confirmation of your figure.
and this:
static string TrimSuffix(string word) { int apostrapheLocation = word.IndexOf('\''); if (apostrapheLocation != -1) { word = word.Substring(0, apostrapheLocation); } return word; }
removes "the words that have it, and gets only the part that is in front of it
i.e. for the word is not he will receive only don
Fawix source share