JSFiddle - React, Tailwind, and code Playground

by nevkatz

HTML

<div id="root">

</div>

JavaScript

var machinify = function(str) {
    if (str) {
      // replace space and apostrophe
     return str.toLowerCase().replace(/\s/g,'-').replace(/\'/,'').replace('.','').trim(); 
    }
    else {
      return 'blank';
    }
  }
  
  const standardize = (str) => str.replace('.','').toLowerCase();
    
    
  let str = "Besoin de plus d'informations.";
  
  let r = document.querySelector('#root');
  
  let s = str.replace(/[.,\/#!$%\^&\*;:{}=\-_`~()]/g,"");
  r.textContent = standardize(s);