How does the ResourceResolver RegEx engine process sling:redirect rules?
Studying this page:
And referencing this documentation:
I have some questions about the regEx processing.
This excerpt taken from the reference document above does not make sense when evaluating the regEx:
This regEx pattern reads as: "Match any string that does not start with a '/' character up to a '/' character and then any number of characters after the '/' that are not a '/' until a '/' is reached and then the characters 'welcome' that end the string with an 'e'.
matches up to "http:/" but then does not match the rest of the string because there is a second '/'.
The regEx would need to be:
Notice the use of '//'.
I have read all about namespace mangling and unmangling but I still cannot figure out how this rule matches.
Further study took me into the /system/console/jcrresolver where I studied some ootb rules and some internal redirects that were created by configuring "vanity urls".
An example internal ootb rule is:
Two example vanity urls are:
And finally an example external url:
All of these examples have the same starting part of the regEx in common which is:
Which would fail on all of the following test urls but somehow they work!
From studying it, I understand that somehow it must be consuming the '//' and then matching on the rest of the expression but I cannot understand how. I have also studied the following java code from Apache Sling:
org.apache.sling.resourceresolver-1.6.0 but am not able to pinpoint how this is working.
How is this regEx processing working and why?