Regular Expression Help

S

sianan

I am looking for a regular expression to validate input into a textbox.
I only want to allow valid alpha-numeric characters (no special
characters, such as ?, *, {} [] etc...).

An example would be much-appreciated!

Thanks!
 
G

Guest

Read that carefully http://www.15seconds.com/issue/010301.htm
I hope it helps
I am looking for a regular expression to validate input into a textbox.
I only want to allow valid alpha-numeric characters (no special
characters, such as ?, *, {} [] etc...).

An example would be much-appreciated!

--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 
J

John Duval

Hi sianan,
You could handle the keypress event and just allow numeric values. You
might also want to allow the delete key. Something like this:

void textBox1_KeyPress(object sender,
System.Windows.Forms.KeyPressEventArgs e)
{
const char Delete = (char)8;
e.Handled = !char.IsDigit(e.KeyChar) && e.KeyChar != Delete;
}

Hope that helps,
John
 
K

Kevin Spencer

\w*

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

Big thicks are made up of lots of little thins.
 

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

Similar Threads

Regular Expression Help 1
Regular expression 5
Regular Expression Text 5
regular expression 7
regular expression NxM 9
c# regular expression 4
Width | Height Regular Expression 1
Regular Expression Help 1

Top