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]*
 
Back
Top