re = /([0-7]\d{2}(" "|-|\.)?\d{2}(?(2)(" "|-|\.))\d{4})/m
str = '
Name SSN Gender Birthday Age Address(street Address, State Zip Code)
Walsh Muhammad 405711626 male 19960508 27 313 Austen Wall Suite 736 East Adeline, KY 19160-6708
Ankunding Noel 579-28-4539 male 19860626 38 5353 Anjali Springs Annabellberg, DC 51532
Bruen Kelly 003-70-9850 female 19860924 37 1703 Adolfo Hill North Avatown, NH 20701-1024
VonRueden Pearline 520-76-6341 female 19830831 41 890 O\'Conner Viaduct Juanaside, WY 98001
Harris Eryn 400-36-0787 female 19720608 52 154 Michelle Plains North Maidaside, KY 61013
Murphy Betsy 400-59-2780 female 19840213 40 936 Douglas Burg Jairomouth, KY 44386-4279
Gusikowski Crystel 508.06.-6325 female 19950819 29 841 Dameon Place Nitzscheview, NE 46251-3648
Grimes Ivy 670-05.5398 female 19780507 45 71345 Fritsch Freeway East Kellyfort, GA 64987
Balistreri Xzavier 232.09-8803 male 19830831 41 5441 Vincenzo Ways Apt. 491 West Bessieshire, WV 85827-5053
Blanda Pamela 396-09-2848 female 19751208 49 1751 Jana Walks Apt. 139 Paulinetown, WI 27274-2921
Hilll London 547-45-3802 male 19760618 48 2133 Ruby Forest South Masonhaven, CA 97443-5496
Will Dale 364-96-7590 male 19940424 30 39099 Hardy Street West Kasey, MI 35581
Muller Scarlett 646-38-0484 female 19981020 25 51954 Connelly Bypass East Nathaniel, UT 96705-2438
Rowe Angie 145-20-9660 female 19881002 35 73566 Maureen Station Karleymouth, NJ 69784-4470
Mitchell Tad 028-54-3165 male 19831101 40 962 Collins Run Port Destiny, MA 59924
Moen Orland 388-15-8827 male 19740629 50 5369 Gabriel Locks Apt. 623 Marvinview, WI 34399-9949
Erdman Tabitha 221-82-2804 female 19781219 46 4874 Roberto Union Suite 252 Dagmarport, DE 93676-9058
Macejkovic Nick 247-96-5798 male 19910925 32 1574 Glover Lights Suite 639 Blanchestad, SC 78776-7217
Feest Lance 512-66-3053 male 19910320 32 998 Sporer Mountain Apt. 664 Port Deangelo, KS 77731
Kuhic Peter 315-30-2791 male 19850807 39 405 Korey Forges Lake Alvena, IN 86152'
# Print the match result
str.scan(re) do |match|
puts match.to_s
end
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html