I want to do a split by "{" and keep the "{".
The result should be an array:
[
"{ \""text\" : \"alinea 1\", \"type\" : \"paragraph\" }",
"{ \""text\" : \"alinea 2\", \"type\" : \"paragraph\" }"
]
The code I have got so far:
("{ \"text\": \"alinea 1\", \"type\": \"paragraph\" }, { \"text\": \"alinea2\", \"type\": \"paragraph\" }").split(/([?={?>={]+)/g)
But the output is not as expected:
I am not a hero with regex... and tried to fiddle a bit with this: Javascript and regex: split string and keep the separator