Click here to Skip to main content
15,908,172 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i've text box and i need to allow only numbers, using ^[0-9]+$ this particular regex expression will not work perfectly, because, if we enter only white spaces in the textbox field it'll validate, and page.isvalid becomes true, how is this possible
this is happening asp.net 4, .net4 framework

What I have tried:

have tried ^[^/s][0-9]+$ but no desired result
Posted
Updated 14-Mar-17 2:09am

This has been asked before and the solution can be found in the net:
c# - RegularExpressionValidator not firing on white-space entry - Stack Overflow[^].
 
Share this answer
 
Not a solution, but a couple of links that I find useful about RegEx:

Here is a link to RegEx documentation:
perlre - perldoc.perl.org[^]
Here is links to tools to help build RegEx and debug them:
.NET Regex Tester - Regex Storm[^]
Expresso Regular Expression Tool[^]
This one show you the RegEx as a nice graph which is really helpful to understand what is doing a RegEx:
Debuggex: Online visual regex tester. JavaScript, Python, and PCRE.[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900