We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now


Searching for a word using wildcards

toreot asked
Medium Priority
Last Modified: 2010-04-04
I want to find the position of a word in a TRichEdit using the characters $ (meaning a vocal), £ (meaning a consonant), # (meaning a double consonant)  and * (meaning any number greater than zero of arbitrary letters). The search word may contain any number and combinations of these four wildcards. Thus, searching for ' *$s*'  would find the word 'close' (but not 'estimate')  and  '*$# '  would find 'fill' (but not 'fil' or 'filling').

I would like a complete algorithm or preferably a working Delphi function.
Watch Question

What do you mean by "a vocal" ? I do not understand the term

have a look at this library :


regards, ZiF.

That looks very nice, see above, sounds like it may provide the solution.

I saw an artical in Delphi informant that did this (kinda)...It was called Soundex algorithms...they used it for a name look up so that if you had data entry order takers get someones name from them they could put it in an edit box an it would find the name even if it wasn't spelled right.  (ie Stevens and Stephens)
go to
the file name is: DI9803RS.ZIP


I will take a look as soon as possible. By the way, I should have checked my English. 'Vokal' in Norwegian is 'vowel' in English.

Check your example also, estimate and close both have a vowel followed by 's' ;)


Yes, but the * in front means that there should be one or more letters in front of the vowel before the s, and 'estimate' starts with the vowel. I should also make it clear that # means two IDENTICAL consonants (bb etc.).
I have looked into the hyperstring library and although it contains many useful functions, I am fairly sure they are too general to solve my problem.

If the original problem seems too daunting, the following simplication would also be useful:
At most one each of #, £, $ and at most two *, one in front and one in the back of the word. At most one substring of letters.

Now I could probably write it myself given enough time, but is there a more experienced programmer out there who takes the challenge? I may increase the points to 500.
I've got something similar that I'm just converting to your needs. I should have it done soon. A couple of questions :-

Do you need it to be case sensitive or not?

Are you only searching for whole words i.e.

for the sentence - 'my walls are red' and a search of  - wa#*
i assume you want the answer 'walls' not 'walls are red'



It should not be case sensitive and  I only want to find whole words.
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview


It seems to work beautifully. Just what I needed. I will give you 500 points.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.