JSFiddle - React, Tailwind, and code Playground

by irinablue

JavaScript

const text = '\n          5. What is a deposit account?\n          \n        ';
const result = text.match(/(\d\.\s)|(\D)+/);
if (result && result.length > 1) {
    console.log(result[1]);
}