var a = /^a/; /正则规则/ var s = 'sdfsdf'; a.test(s); 通过正则测试某个数据是否符合格式要求,符合得到true,不符合得到false false var ss = 'asdfasdf'; a.test(ss); true