bradxr
8/4/2018 - 5:20 PM

Match Letters of the Alphabet

Define a range of characters

let catStr = "cat";
let batStr = "bat";
let matStr = "mat";

let bgRegex = /[a-e]at/;    // character set with range of values from a to e

catStr.match(bgRegex);    // returns ["cat"]
batStr.match(bgRegex);    // returns ["bat"]
matStr.match(bgRegex);    // returns null