So I need to capture individual sub-directories and assign each of them a reference. The reference order doesn't matter, each reference will be checked individually. Here is an example url:
The URL variables (sub-directories) can also be in any order:
here is my regex so far, but it doesn't work.:
^(?:\w+:\/\/)?(?:[\w.-]+)\/?.*$(\/[0-9a-zA-Z-]+\/){0,12}
Try this one:
^(?:\w+:\/\/)?(?:[\w.-]+)?(\/[0-9a-zA-Z-]+){0,12}\/?
If the above one doesn't work, you should do something like this:
^(?:\w+:\/\/)?(?:[\w.-]+)?(?:(\/[0-9a-zA-Z-]+))?(?:(\/[0-9a-zA-Z-]+))?(?:(\/[0-9a-zA-Z-]+))?(?:(\/[0-9a-zA-Z-]+))?(?:(\/[0-9a-zA-Z-]+))?(?:(\/[0-9a-zA-Z-]+))?(?:(\/[0-9a-zA-Z-]+))?(?:(\/[0-9a-zA-Z-]+))?(?:(\/[0-9a-zA-Z-]+))?(?:(\/[0-9a-zA-Z-]+))?(?:(\/[0-9a-zA-Z-]+))?(?:(\/[0-9a-zA-Z-]+))?\/?
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.