JSFiddle - React, Tailwind, and code Playground

JavaScript

var str = 'my string here';

var index = str.match(/\w+\s/g).index;

alert(index); // <- undefined