Note: For Morse to English: For best results, each grouping of morse symbols that translates to a letter should be separated with a space, and each word with two spaces. One space will be eliminated between each morse character, so this will yield natural looking english.
For example, SOS SINKING should be entered as:
... --- ...(two spaces here) ... .. -. -.- .. -. --.
For English to Morse: A space will be inserted between characters unless there is already something between them; if there is only a space, two spaces will be inserted to preserve word separations.
The forward slash / can be translated to morse, so please don't use that as a word separater.
If you lump a bunch of dots and dashes together you'll probably get nothing like what you expected. But short of some complicated string alignment program exploring all possible boundaries to see which give translations that are in the dictionary, that's the best that can be done. Because of how regular expressions work, the longest matching morse character will be pulled off the front of any space-deliniated section that is not itself an entire morse character.