Test, validate and match regular expressions
This Java regex matches a 9-digit Social Security Number (SSN) formatted with optional dashes, dots, or as a continuous string of digits. It includes specific validation rules to avoid common invalid SSN patterns, such as area numbers starting with '000' or '666', and group/serial numbers being all zeros. Notably, it permits underscores in place of digits and is wrapped with `.*` to match entire lines, making it ideal for extracting valid SSN patterns from multiline text or logs.