JSFiddle - React, Tailwind, and code Playground

JavaScript

var str = 'abc def ghi'
var pat = /^abc$/g;
console.log(str.match(pat));