# For Decimal Degrees (DD) dd_regex = r"""(-*\d{1,3}.\d+°*[NnSsWwEe]*)""" # For Degrees, Decimal Minutes (DDM) ddm_regex = r"""(\d{1,3}°*\s*\d{1,2}.\d+[`\']\s*[NnSsWwEe]*)""" # For Degrees, Minutes, Seconds (DMS) dms_regex = r"""(-*\d{1,3}°\s*\d{1,2}[`\']\s*\d{1,2}.*\d+[\"″][NnSsWwEe]*)""" # test coordinates dd = """40.182769°, -104.725968°""" ddm = """40° 10.966'N, 104° 43.558'W""" dms = """40°10'57.96"N, 104°43'33.48"W""" # re.findall() returns the results in a list dd_coords = re.findall(dd_regex, dd, re.X) print(dd_coords) ddm_coords = re.findall(ddm_regex, ddm, re.X) print(ddm_coords) dms_coords = re.findall(dms_regex, dms, re.X) print(dms_coords)