/
(?(DEFINE)
(?'longitude'[-+]?(?|180(?>\.0+)?|(?>1[0-7]\d|[1-9]?\d)(?>\.\d+)?))
(?'latitude'[-+]?(?|90(?>\.0+)?|[1-8]?\d(?>\.\d+)?))
(?'polygon'(?>\s*\(\s*(?<X>(?P>longitude))\s+(?<Y>(?P>latitude))(?>\s*,\s*(?P>longitude)\s+(?P>latitude)){2,}\s*,\s*\k<X>\s+\k<Y>\s*\)\s*))
)^POLYGON\s*\((?P>polygon)(?>,(?P>polygon))*\)$
/
X