[Regex Expression] Find Sets of Characters

Regular Expression Character Classes define a group of characters we can use in conjunction with quantifiers.

var str = `cat bat mat Hat 0at ?at`;
var regex = /[bc]at/g; // match 'cat bat'
// the same as:
var regex = /(b|c)at/g;

var regex = /[^bc]at/g; // matcg 'mat Hat 0at ?at'
var regex = /[a-zA-Z0-9?]at/g; // match all the string,
原文地址:https://www.cnblogs.com/Answer1215/p/5174333.html