正则 [正则] 模式修饰符的可选参数 [正则] 两个测试方法test、exec [正则] 4个正则表达式方法 [正则] 匹配模式 [正则] 常用正则表达式模式修饰符的可选参数:i: 忽略大小写 g: 全局匹配 m: 多行匹配 /hello/: 两个反斜杠是正则表达式的字面量表示法两个测试方法:test
\w表示a-zA-Z_ 锚元字符匹配(^ $) ^强制收匹配 $强制尾匹配,并且只匹配一个
\b表示到达边界 |表示匹配或选择模式
\w等于a-zA-Z0-9_ 使用^限定从首字母匹配 .是特殊符号需要\n进行转义
删除多余空格 方法一: 使用replace只匹配一个,所以使用+匹配多个
|
更多web视频、资料 http://www.makeru.com.cn/ web学习交流群:362513833