Home All Groups Group Topic Archive Search About

Search and Replace using WildCards

Author
27 Mar 2005 5:33 PM
Dennis
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".
--
Dennis in Houston

Author
27 Mar 2005 5:53 PM
Ken Tucker [MVP]
Hi,

        Take a look at regex.replace

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemtextregularexpressionsregexclassreplacetopic.asp

Regular expression info
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconcomregularexpressions.asp

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

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

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

"Dennis" <Den***@discussions.microsoft.com> wrote in message
news:2F520C4A-6D7E-403B-9EAB-1C528E68603A@microsoft.com...
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".
--
Dennis in Houston
Author
27 Mar 2005 6:57 PM
Dennis
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.

Show quoteHide quote
"Ken Tucker [MVP]" wrote:

> Hi,
>
>         Take a look at regex.replace
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemtextregularexpressionsregexclassreplacetopic.asp
>
> Regular expression info
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconcomregularexpressions.asp
>
> http://www.regular-expressions.info/quickstart.html
>
> Regular expression library
> http://www.regexlib.com/
>
> Ken
> ------------------------------
>
> "Dennis" <Den***@discussions.microsoft.com> wrote in message
> news:2F520C4A-6D7E-403B-9EAB-1C528E68603A@microsoft.com...
> 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".
> --
> Dennis in Houston
>
>
>