473,394 Members | 1,700 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Using Regex

Hi,
I need to use "regex" to validate user input into a text
box.

I'm having trouble adding the 'regex' class to my
project. Essentially, I haven't learned how to add it.
can someone tell me how this is done? must I
use "imports"?
If so, please tell me how.
thanks
Nov 20 '05 #1
2 2752
Yes, you need to add this import: Imports System.Text.RegularExpressions
Example------> Dim reg as New Regex("[aeiou]\d")

("[aeiou]\d") this means a vowel followed by a digit.
"larry" <la***@nospamlarry.com> wrote in message
news:06****************************@phx.gbl...
Hi,
I need to use "regex" to validate user input into a text
box.

I'm having trouble adding the 'regex' class to my
project. Essentially, I haven't learned how to add it.
can someone tell me how this is done? must I
use "imports"?
If so, please tell me how.
thanks

Nov 20 '05 #2
It's located in the System.Text.RegularExpressions namespace.

You never have to use "Imports" -- that just gives you to a convenient
shortcut in your code, so you don't have to use fully-qualified class names.
For example, you can either type:

Dim rx as New System.Text.RegularExpressions.Regex

or you can use

Imports System.Text.RegularExpressions
....
Dim rx as New Regex

If you use a class many times in your code, it will save you some typing and
keep your code a little shorter. Nothing more.

In the future, you can find the full name of a class by using the Index in
the MSDN help. For example, typing in "Regex" into the "Look For" box will
direct you to the Regex help page, which tells you that "Regex" is located
in System.Text.RegularExpressions.
"larry" <la***@nospamlarry.com> wrote in message
news:06****************************@phx.gbl...
Hi,
I need to use "regex" to validate user input into a text
box.

I'm having trouble adding the 'regex' class to my
project. Essentially, I haven't learned how to add it.
can someone tell me how this is done? must I
use "imports"?
If so, please tell me how.
thanks

Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Henry | last post by:
I have this simple code, string escaped = Regex.Escape( @"`~!@#$%^&*()_=+{}\|;:',<.>/?" + "\"" ); string input = @"a&+" + "\"" + @"@(-d)\e"; Regex re = new Regex( string.Format(@"(+)", escaped),...
7
by: sbobrows | last post by:
{Whilst I think much of this is OT for this newsgroup, I think the issue of understanding diagnostics just about gets under the door. -mod} Hi, I'm a C++ newbie trying to use the Boost regex...
4
by: Friday | last post by:
Being an Old L.A.M.P guy, I beg you to please excuse my ignorance of dot.net (and all things Windows, for that matter). As part of an experiment (to learn enough ASP/VB.net to port a series of ...
2
by: UJ | last post by:
What's the general feeling on using the using keyword versus spelling the type out completely. For instance, do most people put a using in so they can just say MyNewType or do people not use...
6
by: Extremest | last post by:
I have a huge regex setup going on. If I don't do each one by itself instead of all in one it won't work for. Also would like to know if there is a faster way tried to use string.replace with all...
24
by: garyusenet | last post by:
I'm working on a data file and can't find any common delimmiters in the file to indicate the end of one row of data and the start of the next. Rows are not on individual lines but run accross...
1
by: jonnyboy6969 | last post by:
Hi All Really hoping someone can help me out here with my deficient regex skills :) I have a function which takes a string of HTML and replaces a term (word or phrase) with a link. The pupose...
2
by: apoorva.groups | last post by:
Hi I am facing problem while using regexec function. Ex: String = "abc_def_hig" sub string = "def" regexc if I use regexec the it will find the sub string in string and it will return 0....
4
by: CJ | last post by:
Is this the format to parse a string and return the value between the item? Regex pRE = new Regex("<File_Name>.*>(?<insideText>.*)</File_Name>"); I am trying to parse this string. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.