Given the following string:
/dh-jh-ng-fdhfjfk/djd-gkgi/700194015/image/test.png
Using:
^/[A-Za-z\-]+/[A-Za-z\-]+/[0-9{9}]/?(.*)?
I get the following backreferences:
R0: /dh-jh-ng-fdhfjfk/djd-gkgi/700194015/image/test.png
R1: 700194015/image/test.png
I need R1 to be:
R1: /image/test.png
"/image/test.png" can be any folder, multiple folders, any file, or none, in which case I need a single forward slash. How can I do this?
Note: This is for IIS re-write rules.
Get out of the range quantifier {9}
from the character class , [{9}]
would match a single character from the given list that is it matches {
or 9
or }
.
^/[A-Za-z\-]+/[A-Za-z\-]+/[0-9]{9}(/?.*)?
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.