I have the following sets of strings:
14/04/22 10:45:20 12.08N 87.65W 15.0 2.9ML Frente a Corinto
14/04/21 11:05:34 12.10N 87.70W 140.0 3.5MC Cerca de Masachapa
14/04/22 09:00:09 12.35N 86.44W 12.4 1.3ML Cerca del volcan Momotombo
14/04/21 23:33:37 12.35N 86.63W 7.1 1.0ML SO de La Paz Centro/Nagarote
Now, I am seeking help to transform them into this format:
14/04/22-10:45:20-12.08N-87.65W-15.0-2.9ML-Frente a Corinto
14/04/21-11:05:34-12.10N-87.70W-140.0-3.5MC-Cerca de Masachapa
14/04/22-09:00:09-12.35N-86.44W-12.4-1.3ML-Cerca del volcan Momotombo
14/04/21-23:33:37-12.35N-86.63W-7.1-1.0ML-SO de La Paz Centro/Nagarote
If anyone can assist me in achieving this using Regular Expressions in JavaScript, it would be greatly appreciated.
Thank you!
PS. Edited for clarification. Specifically, I aim to replace all spaces with "-", excluding those spaces before a letter, and also replacing the space before the first occurrence of a letter at the beginning of each word. Please refer to my example above for better understanding of my requirements.