JSFiddle - React, Tailwind, and code Playground
by vaibhav2812
JavaScript
const regex = /\b/g;
const str1 = 'Vaibhav patil'.replace(regex, '~');
console.log(str1);
const str2 = 'Vaibhav_Patil'.replace(regex, '~');
console.log(str2);
const str3 = 'Vaibhav-Patil'.replace(regex, '~');
console.log(str3);
const text = `
Roses are red
violets are blue
Regex are asesome
so do you
`;
console.log(/blue$/m.test(text));