开发者

Regular expression to allow for number values between 1-3 digits?

开发者 https://www.devze.com 2023-01-12 09:26 出处:网络
RewriteRule ^gallery/[0-9][0-9][0-9]/$ index.php?gallery_id=$1 It allows for any number that i开发者_JAVA百科s three digits in length. I do not know how to allow for less than three digits as well (
RewriteRule ^gallery/[0-9][0-9][0-9]/$ index.php?gallery_id=$1

It allows for any number that i开发者_JAVA百科s three digits in length. I do not know how to allow for less than three digits as well (or more than three for that matter).


You want to do something along the lines of

[0-9]{1,3}

There are some excellent examples here. Scroll down to nearly the bottom of the page, there are examples of how the various range selections (not the right term for them) work.

0

精彩评论

暂无评论...
验证码 换一张
取 消