Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / March 2008

Tip: Looking for answers? Try searching our database.

Regular expression problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
dmalhotr2001@yahoo.com - 18 Mar 2008 21:08 GMT
Hi,

I would like to know how to write regular expression in vb.net that
would be valid for a piece of text that is only numbers, letters,
dashes, and underscores that is allowed.

Thanks

:D
Spam Catcher - 18 Mar 2008 23:44 GMT
dmalhotr2001@yahoo.com wrote in news:449748e9-9059-46ed-bd89-934318d6e7f9
@e6g2000prf.googlegroups.com:

> Hi,
>
> I would like to know how to write regular expression in vb.net that
> would be valid for a piece of text that is only numbers, letters,
> dashes, and underscores that is allowed.

[A-Za-z0-9\_]*

Signature

spamhoneypot@rogers.com (Do not e-mail)

jamil@onepost.net - 19 Mar 2008 00:04 GMT
>Hi,
>
[quoted text clipped - 5 lines]
>
>:D

The following expression will do what you requested:

^(?:\w|-)+$

This will match text containing numbers, letters, underscores and
dashes.  If any other characters exist in the string, it will not
match.

If you want partial matches in your string, remove the two anchors as
follows:

(?:\w|-)+

To actually learn how I created that, there are a few books explaining
regular expressions.  I like Friedl's book Master Regular Expressions.
rowe_newsgroups - 19 Mar 2008 12:20 GMT
On Mar 18, 4:08 pm, dmalhotr2...@yahoo.com wrote:
> Hi,
>
[quoted text clipped - 5 lines]
>
> :D

One extremely useful resource for composing regular expressions is
Expresso. It's helps me out a ton whenever I have to use Regex.

Check it out at:

http://www.ultrapico.com/Expresso.htm

Thanks,

Seth Rowe [MVP]

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.