By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,552 Members | 905 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,552 IT Pros & Developers. It's quick & easy.

Wild card sarch in VB/VB.net

P: n/a
Hi,
Could u please let me know how I can do wildcard search in VB.
Examples:
Source string : "Microsoft Dotnet"
Wildcard string M*Dot*
Result should be Microsoft Dotnet

If
Wildcard string is M*Dot
Result should be "Match not found"
If
Wildcard string is M?c*Dot
Result should be Microsoft Dotnet

Your help will be greatly appreciated.
Thanks,
Balaji
Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi Balaji,

What you ask is the regulair expression those are made for questions as
yours, have a look at Regex class

http://msdn.microsoft.com/library/de...classtopic.asp

I hope this helps,

Cor
Hi,
Could u please let me know how I can do wildcard search in VB.
Examples:
Source string : "Microsoft Dotnet"
Wildcard string M*Dot*
Result should be Microsoft Dotnet

If
Wildcard string is M*Dot
Result should be "Match not found"
If
Wildcard string is M?c*Dot
Result should be Microsoft Dotnet

Your help will be greatly appreciated.
Thanks,
Balaji

Nov 20 '05 #2

P: n/a
Hi,

In addition to Cor's comments you can use like to compare strings

Dim strTest As String = "Microsoft Dotnet"

If strTest Like "M*Dot*" Then MessageBox.Show("Wildcard match")

Ken

---------------------------

"Balaji" <ba*****@hotmail.com> wrote in message
news:eu****************@TK2MSFTNGP09.phx.gbl...
Hi,
Could u please let me know how I can do wildcard search in VB.
Examples:
Source string : "Microsoft Dotnet"
Wildcard string M*Dot*
Result should be Microsoft Dotnet

If
Wildcard string is M*Dot
Result should be "Match not found"
If
Wildcard string is M?c*Dot
Result should be Microsoft Dotnet

Your help will be greatly appreciated.
Thanks,
Balaji

Nov 20 '05 #3

P: n/a
* "Ken Tucker [MVP]" <vb***@bellsouth.net> scripsit:
In addition to Cor's comments you can use like to compare strings

Dim strTest As String = "Microsoft Dotnet"

If strTest Like "M*Dot*" Then MessageBox.Show("Wildcard match")


Full ACK, but don't forget that 'Like' is still buggy in some
situations.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.