JSFiddle - React, Tailwind, and code Playground
by Ty
HTML
<h2>Regex challenge</h2>
<ul>
<li>Match a string that ends with two numbers</li>
<li>Match a string that does not contain lowercase letters</li>
<li>Match a string starting with 'foo' or 'baz'</li>
<li>Match a hexidecimal string</li>
</ul>(a digit)(two of 'em)(end of the string)
JavaScript
function match(str) {
return (/[0-9],{2}$/).test(str);
}
function match(str) {
return (/![a-z],{1}/).test(str);
}
function match(str) {
return (/^[foo || baz]/).test(str);
}
function match(str) {
return (/{0-9},[a-f],{1}/);
}