Link to home
Create AccountLog in
Avatar of Saqib Husain
Saqib HusainFlag 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
ASKER CERTIFIED SOLUTION
Avatar of Robert Schutt
Robert Schutt
Flag of Netherlands image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of 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.
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":
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.