KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I need to validate an input on a form. I'm expecting the input to be a number between 1 to 19 digits. The input can also start with zeros. However, I want to validate that they are not all zeros. I've got a regex that will ensure that the input is numeric and between 1 and 19 numbers. ^\d[1,19]$ But I can't figure out how to include a check that the entire string is not all zeros. I tried this ^(![0]{1,19})(\d[1,19])$ but it fails on 0000000000000000001 because it's allowing a variable number of zeros. How do I check that the entire string is NOT zeros? Thanks. I'm trying to do this in a ASP.NET RegularExpressionValidator so I was hoping for a single expression. I have other options, so I'm not out of luck if this can't be done.
Tags (comma-separated)
Save Edits
Cancel