tags:

views:

52

answers:

1

I cannot manage to get a working regular expression (for use in ASP.NET Validataor) for the following criteria:

  • I want all chars from A-Z a-z 0-9
  • I don't want the Enter key

I have the expression: [\w\s,.-/]*[^\n] but that doesn't work.

Can anyone give me a hint?

+3  A: 

This will match only characters that you're requiring:

[A-Za-z0-9]+
SilentGhost
Hi... I forgot to told that i need the space char too.If i use your expression with the space [A-Za-z0-9\s]+ the enter is allowed too :(
TiagoDias
@TiagoDias: `\s` is all white space characters, if you only want space " ", then include it directly `[0-9 a-zA-Z]+`.
Richard
Thank U Richard.
TiagoDias