Regular expression flag or modifier # 04

 








The. metacharacter(wildcard)

Wildcard selects any single character. It never selects the character of the new line.









The escaping(\) metacharacter

By using escaping metacharacters, we can limit our search for those who have value after the backslash. i.e; in the example below g. will search for the match.


















If we want to use metacharacters inside of the character set [ ]. Then we need backslash only for four metacharacters.

[-/*]]


const grText =
 "ABCDEFGHIJK abcdefghijk\n\t01234567890!@#$%^&()fsdfsdfdsf fsdfsdrew AB";
const newReg = new RegExp(".", "g");
const matchResult = grText.match(newReg);
console.log(matchResult);

Post a Comment

Previous Post Next Post