JSFiddle - React, Tailwind, and code Playground

HTML

<div id="d1" class="line1"></div>

CSS

body {
    padding:15px;
}

div {
    border: 1px solid #000000;
    padding:5px;
    background-color:#EFEFEF;
    margin:5px;
}

JavaScript

$(function() {

    new_regex_rule = 'hello,bl.com,dkd-dkd.com,blub,blib,satssan kommt';
    
    // new_regex_rule = new_regex_rule.replace(/[a-z][0-9][-.]/gi,''); 
   
    $('#d1').append('<hr />'+new_regex_rule+'<hr />');  
    
    if(new_regex_rule.match(/\s/)){ new_regex_rule = new_regex_rule.replace(/\s/,'\\s'); }
    if(new_regex_rule.match(/,/)){ new_regex_rule = new_regex_rule.replace(/\,/,'|'); }
 
    $('#d1').append('<hr />'+new_regex_rule+'<hr />');  
});