Avatar of Saqib Husain
Saqib Husain
Flag for Pakistan 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
Microsoft Excel

Avatar of undefined
Last Comment
Robert Schutt

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Robert Schutt

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Saqib Husain

ASKER
I wouldn't call that a Whole word match but more a beginning of word match

I agree but what I wanted was something short to write in there.

Thanks, looks good now.
Saqib Husain

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?
Robert Schutt

Yes sure, couple of options. In the userform code (line 19) you could specify "standard word boundary or underscore":
re.Pattern = "(\b|_)" & strInput ' "(^|[ ,_-])"

Open in new window


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.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes