Three basic rules for URL regex:
- ? matches one character.
- * matches zero or more characters.
- ** matches zero or more 'directories' in a path.
An asterisk ('*') matches zero or more characters, up to the occurrence of a '/' character (which serves as a path separator).
A string, such as "/abcd/docs/index.html", would not match successfully against the pattern '/*/*.index.html'. The first asterisk matches up to the first path separator only, resulting in the "abcd" string. A successful matching pattern would be '/*/*/*.html'.
A string containing two asterisks ('**') matches zero or more characters.
This could include the path separator '/'. In this case, "/abcd/docs/index.html" would successfully match the '/**/*.html' pattern. The double asterisk, including the path separator, would match the "abcd/docs" string.
No comments:
Post a Comment