I need to split a string by seperators that are known to me and also unknown. For example i know i want to split the string by "\n" and "," and "." but also 1 sperator that can be user defined: for example it can be ";" or "hello" or pretty much anything.
I tried this:
"[\n|,|.|".$exp."]"
...but that didnt work as expected. As i understand | means or. So this reg exp should say that split by "\n" or "," or "." or "hello". I think its because if i try just [hello] then it splits by every letter, not the whole word. Thats strange because if i try just [\n] then it only splits by "\n" - not by "\" or "n".
Can someone please explain this to me? :)