How do you match characters separated by a specific character, lets say ';' and ignore the spaces in front of and behind the match but retain the one inside?
(word1); (word2) ; (word31 word32)
Paranteses only denote the matches.
So far I have \s*([a-zA-Z0-9\s]*[a-zA-Z0-9]+)\s*[;]
but I don't know how to make the words repeat. And it should also be capable of handling empty words, so something like (word);;(word)
,(word); ;(word)
or (word);(word);
. Since it ignores spaces the first two should be equivalent.
Well the main problem is that I don't know how to handle the split and the two options of legit word and empty word since my statement requires at least 1 symbol.
Alternatively it could be solved if I allow repeated separator that has spaces in between, but that loops back to the fact I don't know how to handle the splitting.
Edit: Also i intend to use it in C++
Edit: This is probably it, can i get factcheck? \s*([a-zA-Z0-9\s]*[a-zA-Z0-9]+)[;]*\s*[;]*