1、规则:[0-9]-[0-9] or \d-\d 结果相同
测试文本:booood a68AVKJsj2-1*-?
匹配结果:2-1
2、匹配所有字符:
规则:
[\s\S]*
测试文本:
?active
匹配结果:
?active
3、问号的匹配:
规则:^\?
测试文本:?active
匹配结果:?
4、非数字匹配:
规则:\D or [^0-9]
测试文本: ?active
test
results
//\\@ !%^&*(+
匹配结果: ?active
test
results
//\\@ !%^&*(+
转载于:https://blog.51cto.com/shouhouzhe/1376841