private bool DoMatchesWord(NSString text, int location, int length, Regex word) { bool matches = false; if (location >= 0 && location + length <= text.length()) { string str; text.getCharacters_range(new NSRange(location, length), out str); Match match = word.Match(str); matches = match.Success && match.Length == str.Length; } return matches; }