如何使用最大检查( v1 UUID )精确地重写一个36个字符的RewriteRule?
UUID() returns a value that conforms to UUID version 1 as described in RFC 4122. The value is a 128-bit number represented as a utf8 string of five hexadecimal numbers in aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee format:
请给一些比这更好的东西:RewriteRule ^([A-z0-9\-]{36})$ index.php?uuid=$1 [L,QSA]
发布于 2020-07-08 05:59:54
你可以尝试:
^[a-fA-F0-9]{8}-(?:[a-fA-F0-9]{4}-){3}[a-fA-F0-9]{12}$对上述正则表达式的解释:
^, $ -分别表示行的开始和结束。[a-fA-F0-9]{8} --根据docs;作为一个由五个十六进制数字组成的utf8字符串;所以只允许十六进制字符是好的。因此,-之前的第一个字符串是8个字符长的十六进制值。(?:[a-fA-F0-9]{4}-){3} -表示一个非捕获组匹配四次十六进制字符,然后是一个-,整个模式精确重复3次。[a-fA-F0-9]{12} --精确地表示十六进制字符12次。$0 -对于匹配部分,您可以使用第0次捕获组,因为没有特殊的捕获。

https://stackoverflow.com/questions/62776450
复制相似问题