Regex to match for zeros

I am looking for a regex pattern that would match several different combinations of zeros such as 00-00-0000 or 0 or 0.0 or 00000

Please help

Thanks!

EDIT:

Well, I have web service that returns me a result set, based on what it returns me I can decide if the result is worth displaying on the page. So if I get either 00-00-0000 or 0 or 00000 I would assume that data was not found, however if it brings back 001 or 000123 or 0356.00 - 1000 or 0.6700, this would be valid.

Hope this clarifies my question

Thanks

Answers


[^123456789]+

or

[^1-9]+

I believe this is what you are searching for...


You need to better define what is valid to appear between the zeros. Going from your question, I'll assume you're looking for any number of zeros with any number and grouping of "-" and "." between them....

0([-.]?0+)*

Hope you don't mind, SoapBox:

Based on the question edit, what you are looking for is any string that has non-zero digits in it, so:

[1-9]

or, if the regex engine automatically anchors start and end of string:

.*[1-9].*

may be the better solution.

This is the reverse of the test you asked for but that's a simple matter to change (reverse the sense of the if-statement).


Need Your Help

Jquery colorbox: initialize gallery on click

jquery colorbox

I'm using the manual colorbox call like so:

Which browsers support <script async="async" />?

javascript html performance asynchronous google-analytics

On December 1, 2009, Google announced support for asynchronous Google Analytics tracking.