The Morse string will never contain a '|' because it would have been
already replaced in a previous sanitization step.
Also we don't define anywhere that '|' can act as an alternative word
separator, so it should be replaced with a space just like any other
invalid character.
def sanitize_morse(self, morse):
sanitized = re.sub("_", "-", morse)
sanitized = re.sub(r"[^\-\.\/]", " ", sanitized)
- sanitized = re.sub(r"\|", "/", sanitized)
sanitized = re.sub(r"\s+", " ", sanitized)
sanitized = re.sub(r"( ?/ ?)+", " / ", sanitized)
sanitized = re.sub(r"^[ /]+", "", sanitized)