Saqib Husain
asked on
Phonebook application - Enhacing search capabilities
I have this phonebook application developed through this TA, the latest version at
https://www.experts-exchange.com/questions/28645108/Phonebook-application-Adding-the-ability-to-edit-existing-entries.html
I have modified the data in this file and would like to enhance the search capability.
Currently the search looks for the string anywhere in the data field.
I would like to have a checkbox called "Whole words" which, when unchecked, works just as it does now.
When the checkbox is checked the search should look at whole words or numbers. So that ro would match Rory and not broomee. I think the delimeters for a word or number should be
space
comma
hyphen
There could be more but I think I can add that later.
PhonebookEEv5.0.xls
https://www.experts-exchange.com/questions/28645108/Phonebook-application-Adding-the-ability-to-edit-existing-entries.html
I have modified the data in this file and would like to enhance the search capability.
Currently the search looks for the string anywhere in the data field.
I would like to have a checkbox called "Whole words" which, when unchecked, works just as it does now.
When the checkbox is checked the search should look at whole words or numbers. So that ro would match Rory and not broomee. I think the delimeters for a word or number should be
space
comma
hyphen
There could be more but I think I can add that later.
PhonebookEEv5.0.xls
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
HI, again, I just discovered that the underscore is not considered a word separator. I cannot pick Chris_Bottomley by typing B. Can you do something about it?
Yes sure, couple of options. In the userform code (line 19) you could specify "standard word boundary or underscore":
The comment there shows the alternative I mentioned earlier where you only allow the exact characters you want. Just make sure the "-" is the first or last character within the range (block quotes) because otherwise it changes the meaning to a range of characters.
re.Pattern = "(\b|_)" & strInput ' "(^|[ ,_-])"
The comment there shows the alternative I mentioned earlier where you only allow the exact characters you want. Just make sure the "-" is the first or last character within the range (block quotes) because otherwise it changes the meaning to a range of characters.
ASKER
I agree but what I wanted was something short to write in there.
Thanks, looks good now.