Guys, I'm not sure if regular expressions are the answer to this, but I might need some help with regular expressions.
Basically, I want to replace all spaces that fit a certain set of criteria with semicolons or something, in order to sanitise a data file.
The data looks like this:
47 5-9 Carats Near Gem Cubes 1 1 336.45 1,291.00 434,356.95
48 5-9 Carats Mixed Rejns 1 1 1,897.63 228.00 432,659.64
49 5-9 Carats Mixed Rejns 1 1 1,897.89 228.00 432,718.92
50 3-4 Carats White Gem Z 1 1 372.94 2,180.00 813,009.20
Now, by the human eye, I can clearly see that the data is separated by spaces, apart from "5-9 Carats Near Gem Cubes", which is a string field that contains spaces within the string. What I want to do is either replace the separating spaces with semicolons, or wrap speech marks around the string field.
The rule to me is clear: the first space is a separator, and the last 5 spaces are separators, but all the spaces in between are part of the string. So how do I only select the 6 separator spaces using a regular expression? Or do I need to do it in a different way? Should I just make a python script that does it instead?