Accepting blankspace in regular expression

S

sivagururaja

Hi All,

Im using a regular expression to validate user input.
This is my expression ([a-zA-Z0-9]{0,50}).
This works fine.
But 'm using multiline TextBox.
It can't accept blank space and a new line character.
How can i get it?
Help me if you know about it.

Thanks,
Raja
 
P

Peter Bradley

Hi Raja,

I haven't tested it in .NET, but what you have certainly works OK in most
regular expression implementations. I checked it in Perl and it's just
fine.

The only thing I'd alter would be to put a '^' and the start, and a '$' at
the end of your expression to ensure that the entire string matches, and not
just part of it.

^[a-zA-Z0-9]{0,50}$

You do realise that this will match the null string, by the way, don't you?

HTH


Peter
 

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 problem 13
Regular Expression 1
Regular Expression question 4
Regular Expression 3
Regular expression 1
Regular Expression 1
Regular expression for BOM required 6
Basic Regular Expression question 3

Staff online

Members online

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top