In Elixir, I would like to split a string, treating all the non-word characters as separators, including the "Ogham Space Mark ( )" (which should not be confused for a minus (-) sign).
So, if I split the string:
"1\x002\x013\n4\r5 6\t7 + asda - 3434"
The result should be:
["1","2","3","4","5","6","7","+","asda","-","3434"]
I'm trying to figure out how to do this with Regex, but the best I've been able to accomplish so far is:
Regex.split(~r/[\W| ]+/, input_string)
.... but this drops the + and - sign as these are not considered word characters.
or
Regex.split(~r/[^[:punct:]|^[:alnum:]| ]+/, input_string)
but this fails to split on the Ogham Space Mark.
This will actually work correctly, but it is inelegant for the extra transformation:
Regex.split(~r/[^[:punct:]|^[:alnum:]]+/, String.replace(input_string, " ", " "))
Is there any way to split this with a single Regex invocation?