So I have a RichTextBox, and an ArrayList containing the tokenized contents of that RichTextBox. I can get the start location of my selection and length and all that good stuff. Any time the RichTextBox contents change, I regenerate my ArrayList.
Now, basically, my quandry ends up being what is the best way to find a selected bit of text (a word, hopefully) within the array? I need to take into account the fact that selected text can be in the array and textbox multiple times.
To describe further...take this text and pretend it is in a RichTextBox. I highlight the second instance of RichTextBox expecting my function to return an int 15 (disregarding spaces and punctuation).