JSFiddle - React, Tailwind, and code Playground

JavaScript

function count(string) {
  var match = /0000>(.*)<0000/g.exec(string);

  if (match.length > 1) {
    return match[1].trim().length;
  } else {
    return null;
  }
}

alert (count("0000> hello my name is james, whats yours? <0000"))