(?x) (?# allow comments and whitespace)
< (?# start of opening tag)
( (?# start of capturing parenthesis)
loc (?# loc )
2? (?# optional 2 )
) (?# end of capturing parenthesis. Will match and store 'loc' or 'loc2' in capture \1)
> (?# end of opening tag)
[1-5] (?# one digit in the range 1..5)
(?: (?# start of non-capturing parenthesis)
\. (?# a dot. It has to be escaped otherwise it will be considered a one character wildcard.)
\d+ (?# one or more digits)
) (?# end of non-capturing parenthesis)
+ (?# one or more occurrence of the non-capturing parenthesis)
</ (?# start of closing tag)
\1 (?# captured value of first capturing parenthesis)
> (?# end of closing tag)