Regular expression question with .NET

  • Thread starter Thread starter Andrew Gaskell
  • Start date Start date
A

Andrew Gaskell

Dear all

I'm having problems generating a regular expression in .NET, having
just started using regular expressions.

I am trying to validate a user's full name. So far I have:

[\D]* as the regular expression to prevent the user entering digits.

However I also want to disallow the following characters which have no
place in a name: !"£$%^&*()_-+=@:;{[}]~#>.<,?/|\`¬

Can someone please tell me what I need to do to add to my current
regular expression above in order to do this?

Thanks very much
Andrew
 
(e-mail address removed) (Andrew Gaskell) wrote in
Dear all

I'm having problems generating a regular expression in .NET, having
just started using regular expressions.

I am trying to validate a user's full name. So far I have:

[\D]* as the regular expression to prevent the user entering digits.

However I also want to disallow the following characters which have no
place in a name: !"£$%^&*()_-+=@:;{[}]~#>.<,?/|\`¬

Can someone please tell me what I need to do to add to my current
regular expression above in order to do this?

Thanks very much
Andrew

Why not just specify what the name CAN contain. It is much easier...

[a-zA-Z]*

--
Michael Lang, MCSD
See my .NET open source projects
http://sourceforge.net/projects/colcodegen/ (simple generic code generator)
http://sourceforge.net/projects/dbobjecter (database app code generator)
http://sourceforge.net/projects/genadonet ("generic" ADO.NET)
 
Michael
thanks very much! I think I was making it too difficult!

Regards
Andrew

Michael Lang said:
(e-mail address removed) (Andrew Gaskell) wrote in
Dear all

I'm having problems generating a regular expression in .NET, having
just started using regular expressions.

I am trying to validate a user's full name. So far I have:

[\D]* as the regular expression to prevent the user entering digits.

However I also want to disallow the following characters which have no
place in a name: !"£$%^&*()_-+=@:;{[}]~#>.<,?/|\`¬

Can someone please tell me what I need to do to add to my current
regular expression above in order to do this?

Thanks very much
Andrew

Why not just specify what the name CAN contain. It is much easier...

[a-zA-Z]*
 

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 7
Runtime error with Regular Expression 3
Regular expressions 20
Regular expression 5
regular expression question 6
Regular Expressions 4
regular expression NxM 9
Regular Expressions 4

Back
Top