JSFiddle - React, Tailwind, and code Playground

JavaScript

var regex = /(\*)([^\0].+)*(\*)/g; 
    var input = "* Match this text Match this text (this is a line break -> \n) Match this text (\n) Match this text Match this text * more text more text"; 
    if(regex.test(input)) {
        var matches = input.match(regex);
        for(var match in matches) {
            alert(matches[match]);
        } 
    }
    else {
        alert("No matches found!");
    }