I'm usually pretty decent at regex but this basic one has me stumped.
preg_match('/^(\+|-)\s+(month|week|year|day)$/i', '-1 month');
This is returning 0. Can anyone tell me why? It seems to be breaking on the \\s
.
Note: I have tried escaping the -
.
你没有考虑数字:
preg_match('/^(\+|-)\d+\s+(month|week|year|day)$/i', '-1 month');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.