<html> <head><title>504 Gateway Time-out</title></head> <body> <center><h1>504 Gateway Time-out</h1></center> <hr><center>nginx</center> </body> </html>

there are some troublesome data. The date is a mixture of mm.dd, mm.d, m.dd and m.d. I want to match it with a regular. I write a data like this: / ^ ([1-9] | 0 [1-9] | 1 [0-2]) (\.) ([1-9] | 0 [1-9] | 1-2 | 3 [0-1]) $/ g. I found that this data can match the format of a single target. Something like "7.13 ssssssssss 7.14 ss:ss aaa:aa 7.15" does not match. I am not very familiar with the rules. Come to the forum for advice.


'7.13 ssssssssss 7.14 ss:ss aaa:aa 7.15'.match(/\b(10|1?[1-9])\.(3[01]|10|20|[12][1-9])\b/g)
//["7.13", "7.14", "7.15"]

you don't need regular split ('.') Then check whether each item in the array meets the requirements

Menu