Skip to content

Commit

Permalink
🎨 Use a regex to detect if a string is an object name or a coordinate
Browse files Browse the repository at this point in the history
  • Loading branch information
Xen0Xys committed Apr 18, 2024
1 parent dec02bc commit 9c36e6b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ipyaladin/coordinate_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@


def parse_coordinate_string(string: str) -> SkyCoord:
if string[0].isalpha():
regex = r"^[0-9][0-9: hmsd.+-]+$"
if not re.match(regex, string):
return SkyCoord.from_name(string)
coordinates: tuple[str, str] = _split_coordinate_string(string)
ra: Angle or None = None
Expand Down

0 comments on commit 9c36e6b

Please sign in to comment.