I need to remove the spaces between words in a variable, but never remove any of the spaces which are next to any of these symbols: ①, ②, ③, ④, ⑤, ⑥, ⑦, ⑧, ⑨, or ⑩. E.g.:
The bear ate the fish.
This becomes:
Thebearatethefish.
E.g.:
The ① bear ate the ② fish.
This becomes:
The ① bearatethe ② fish.
How can I remove all of the spaces from a variable, except for those spaces which appear next to one of those symbols?
Normally what you would want to do is do a pattern replace:
Now you need to teach gsub about the special characters:
This will substitute any whitespace as long as the previous and next character is not in the set. If don’t have Lua compiled with unicode, you might need to substitute the characters with the proper unicode values.