Test, validate and match regular expressions
This regex matches legal document references to subparagraphs at the start of a line, such as 'Subparagraph (a)', 'subparagraphs (b), (c) and (d)', or 'paragraph (a) to (c) of'. It handles optional prefixes ('sub-', 'paragraph', plural 's'), lists joined by commas, 'and', or '&', letter ranges using 'to', and trailing 'of' phrases. It is useful for parsing statutes, regulations, and contracts to extract or standardize citation references.