Search and Replace using WildCards

G

Guest

I am trying to implement a "Find and Replace" dialog that allows using
wildcards in the find string, much like the Find and Replace Dialogs in Ms
Word, etc. Are there any references or examples on this. I have tried using
the Like comparision operator but about all I can do with it is replace a
whole string that contains the wildcard search string.

I want to do something like finding *mysea?rch in a string like "This is
mysearch string that I want to search" then replace with "NewString" such
that I get "NewString string that I want to search".
 
K

Ken Tucker [MVP]

Hi,

Take a look at regex.replace

http://msdn.microsoft.com/library/d...tregularexpressionsregexclassreplacetopic.asp

Regular expression info
http://msdn.microsoft.com/library/d...s/cpguide/html/cpconcomregularexpressions.asp

http://www.regular-expressions.info/quickstart.html

Regular expression library
http://www.regexlib.com/

Ken
------------------------------

I am trying to implement a "Find and Replace" dialog that allows using
wildcards in the find string, much like the Find and Replace Dialogs in Ms
Word, etc. Are there any references or examples on this. I have tried using
the Like comparision operator but about all I can do with it is replace a
whole string that contains the wildcard search string.

I want to do something like finding *mysea?rch in a string like "This is
mysearch string that I want to search" then replace with "NewString" such
that I get "NewString string that I want to search".
 
G

Guest

Thanks Ken. I was, of course, aware of Regex Class but I had hoped not to
have to learn Regex language in depth but probably will have no choice but to
do so. I was hoping some kind programmer had posted some code that would use
the standard wildcards in some Search and Replace code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top