JSFiddle - React, Tailwind, and code Playground

JavaScript

let mystring = 'test {{hello}} goodbye {{foo}} bar {foobar}';
let regex = /\{\{(.*?)\}\}/g;

console.log( mystring.match( regex ) );