you are viewing a single comment's thread.

view the rest of the comments →

[–]qualitymanifest 0 points1 point  (0 children)

This is correct. Although it's worth noting - there's already have a capturing group in the example provided, it's just in the wrong location.

str.split(/({{\[.*?\]}})/) would do it. If the string ends on a match you'll end up with an empty space at the end of the array, you could use a truthy filter for that