JSFiddle - React, Tailwind, and code Playground
by josekerekes
HTML
<div id="box1"></div>
<div id="box2"></div>
<div id="box3"></div>
<div id="box4"></div>
<div id="box5"></div>
JavaScript
var text="hello you doggy"
var bool=/you/.test(text);
var bool2= /(o)/g.exec(text); //returns only the first match with all subsections
var bool3 = text.match(/(o)/g);
$('#box1').text(bool);
$('#box2').text(bool2);
$('#box3').text(text.charAt(0));
$('#box4').text(text.charCodeAt(0))
$('#box5').text(bool3)
//string.concat(string)
//string.indexOf(string, position)
//string.search(regexp)
//string.lastIndexOf(string,position)
//string.localCompare(string)
//string.match(regexp)
//string.replace
//