Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
27
rated 0 times [  33] [ 6]  / answers: 1 / hits: 9522  / 11 Years ago, thu, february 6, 2014, 12:00:00

I have a data of day and I need to check if it contain only 0.
How I can check if string contain only 0?
I want to do it with regular expressions.


More From » regex

 Answers
4
/^0*$/.test(subject)


returns True for a string that contains nothing but (any number of, including 0) zeroes. If you don't want the empty string to match, use + instead of *.


[#48003] Wednesday, February 5, 2014, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
bryantc

Total Points: 455
Total Questions: 96
Total Answers: 110

Location: San Marino
Member since Thu, Jun 30, 2022
2 Years ago
bryantc questions
Fri, Aug 13, 21, 00:00, 3 Years ago
Tue, Mar 30, 21, 00:00, 3 Years ago
Fri, Jun 5, 20, 00:00, 4 Years ago
Wed, May 27, 20, 00:00, 4 Years ago
;