() 小括号,匹配一段固定格式字符串
var reg1 = /(abc)/ 匹配abc
reg1.test('abc') //true
reg1.test('abcdf') //true
reg1.test('a') //false
[]中括号,匹配字符组
var reg2=/[abc]/ 匹配包含任意abc三个字母
reg2.test('abc') //true
reg2.test('a') //true
reg2.test('ab') //true
reg2.test('ababfcab') //true
reg2.test('ad') //true
小练习 一段文字以 对不起 或 谢谢 结尾,结尾有空格则忽略空格
var reg3 = /(对不起s*$)|(谢谢s*$)/gi 版本一
var reg3 = /[(对不起)|(谢谢)]s*$/gi 版本二