The task is to split address on parts by point or space.
For example: “c.Town” should be split to “c.” and “Town”
And “c Town” to “c” and “Town”
I use the following regex:
address.split("(?=[ .])")
It splits address “c.Town” on 2 parts: “c” and “.Town”.
So the point is attached to the second element (“.Town”). But I expected point to be attached to first element (“c.”).
As a result, instead of “c.”, “Town”, I receive “c”, “.Town”.
What am I doing wrong?