Assuming I've been given the following to match against:
insert 'hello world' into {This is a test}
I want to match on whitespaces and push every match to my string array, because I need to know the index of the text in the string.
Here comes the tricky part; whitespaces inside single quotes (') and inside curly brackets ({}) must be excluded
My desired result would be:
- insert
- 'hello world'
- into
- {this is a test}
So far I've been able to exclude the whitespaces inside single quotes, however I can't figure out how to combine it with the curly brackets.
My regex as of now:
\s(?=(?:[^']|'[^']')$)