JSFiddle - React, Tailwind, and code Playground

JavaScript

var str = 'f 34 545 323 12345 54321 123456';

var matches = str.match(/\b\d{5}\b/g);

console.log(matches);