/^(https?:\/\/)?([\w\.]+)\.([a-z]{2,6}\.?)(\/[\w\.]*)*\/?$/
^ assert position at start of the string
1st Capturing group (https?:\/\/)?Quantifier: ? Between zero and one time, as many times as possible, giving back as needed [greedy]
Note: A repeated capturing group will only capture the last iteration. Put a capturing group around the repeated group to capture all iterations or use a non-capturing group instead if you're not interested in the data
http matches the characters http literally (case sensitive)
s? matches the character s literally (case sensitive)
Quantifier: ? Between zero and one time, as many times as possible, giving back as needed [greedy]
: matches the character : literally
\/ matches the character / literally
\/ matches the character / literally
2nd Capturing group ([\w\.]+)[\w\.]+ match a single character present in the list below
Quantifier: + Between one and unlimited times, as many times as possible, giving back as needed [greedy]
\w match any word character [a-zA-Z0-9_]
\. matches the character . literally
\. matches the character . literally
3rd Capturing group ([a-z]{2,6}\.?)[a-z]{2,6} match a single character present in the list below
Quantifier: {2,6} Between 2 and 6 times, as many times as possible, giving back as needed [greedy]
a-z a single character in the range between a and z (case sensitive)
\.? matches the character . literally
Quantifier: ? Between zero and one time, as many times as possible, giving back as needed [greedy]
4th Capturing group (\/[\w\.]*)*Quantifier: * Between zero and unlimited times, as many times as possible, giving back as needed [greedy]
Note: A repeated capturing group will only capture the last iteration. Put a capturing group around the repeated group to capture all iterations or use a non-capturing group instead if you're not interested in the data
\/ matches the character / literally
[\w\.]* match a single character present in the list below
Quantifier: * Between zero and unlimited times, as many times as possible, giving back as needed [greedy]
\w match any word character [a-zA-Z0-9_]
\. matches the character . literally
\/? matches the character / literally
Quantifier: ? Between zero and one time, as many times as possible, giving back as needed [greedy]
$ assert position at end of the string