JSFiddle - React, Tailwind, and code Playground

by davorpeic

HTML

<div id="text">

</div>

JavaScript

function encode(text){
	var string = text;
  return string
  	.replace(/\+/g, '-') // Convert '+' to '-'
    .replace(/\//g, '_') // Convert '/' to '_'
    .replace(/\=/g, '-') // Convert '=' to '-'
}

var content = "text 123/123/2016 + 789 abc";
document.getElementById("text").innerHTML = encode(content);