Regular expression for validating a url
I'm sorry my English skills but I'll try to explain my question.
Actually, none of the given answers are fully cover the request.
Lookbehind has limitations, like the phrase cannot include quantifiers. You can use alternation, but only if all alternatives have the same length.
That's why for some cases I'll be using Lookahead instead, which is the same, but in the opposite way. These flavors evaluate lookbehind by first stepping back through the subject string for as many characters as the lookbehind needs, and then attempting the regex inside the lookbehind from left to right.
The following expressions will validate the number of days in a month but will NOT handle leap year validation; hence february can have 29 days every year, but not more. A SIN should also be validated by computing the checksum digit.
This regex will tolerate the form XXX XXX XXX, XXXXXXXX or XXX-XXX-XXX. Since every part of a path is separated by a \ character, we only need to find the last one.