I want to parse this string
[[delay-4]]Welcome! [[delay-2]]Do you have some questions for us?[[delay-1]] Please fill input field!
I need to get something like this:
[
[0] => '[[delay-4]]Welcome!',
[1] => '[[delay-2]]Do you have some questions for us?',
[2] => '[[delay-1]] Please fill input field!
];
String can also be something like this (without [[delay-4]] on beginning):
Welcome! [[delay-2]]Do you have some questions for us?[[delay-1]] Please fill input field!
Expected output should be something like this:
[
[0] => 'Welcome!',
[1] => '[[delay-2]]Do you have some questions for us?',
[2] => '[[delay-1]] Please fill input field!
];
I tried with this regex (https://regex101.com/r/Eqztl1/1/)
(?:\[\[delay-\d+]])?([\w \\,?!.@#$%^&*()|`\]~\-='\"{}]+)
But I have problem with that regex if someone writes just one [ in text, regex fails and if I include [ to match I got wrong results.
Can anyone help me with this?