Hello,
im currently working on a program to split a string based on symbols only, i need to seperate the string around the symbols whilst keeping the symbols as well eg.
test_String_123_^;
would result in an array containing : [test] [] [String] [] [123] [_] [^]
However although i have achieved it with this code :
exampelstring.split("(?<=\\^)|(?=\\^)|(?<=\\_)|(?=\\_)");
I was wondering if there is a way to achieve this with less code as if i add more symbols then the regex becomes huge have a forward and behind check for each symbol. Is there a way to combine multiple lookaheads and lookbehinds into the same regex or a cleaner way of performing such a split?
Thanks for helping :)