Test, validate and match regular expressions
This regex matches HTML data attributes with or without values. It captures the attribute name (like 'data-id' or 'data-user-name') in the first group and optionally captures the attribute value (without quotes) in the second group. It handles both single and double quoted values, making it useful for parsing HTML content, extracting custom data attributes, or validating data attribute syntax.