个人笔记有关正则匹配的几点小笔记
Posted 未将对象引用设置到对象的实例
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了个人笔记有关正则匹配的几点小笔记相关的知识,希望对你有一定的参考价值。
匹配单个数字(不能>10): \d
匹配>10的数字: \d+
"1-WIFI-MAC_Match 2-WIFI-MAC_Match_Trust 3-WIFI-MAC_Mismatch 4-WIFI-MAC_History_NegativeList 5-WIFI-MAC_Missing“ "1-CERTNO_Match_Sharing_Bad 2-CERTNO_Match_Trust_Self_Sharing_Bad 3-CERTNO_Match_Sharing_Good 4-CERTNO_Match_Trust_Self_Sharing_Good 5-CERTNO_Match_Recency_Bad 6-CERTNO_Match_Trust_Self_Recency_Bad 7-CERTNO_Match_Recency_Good 8-CERTNO_Match_Trust_Self_Recency_Good 9-CERTNO_Match_Reliability_Bad 10-CERTNO_Match_Trust_Self_Reliability_Bad 11-CERTNO_Match_Reliability_Good 12-CERTNO_Match_Trust_Self_Reliability_Good -1-获取失败"
匹配类似"1-IMSI_Match_Sharing_Bad","-1-获取失败":"(?:-1|\d+)(-[a-zA-Z\u4e00-\u9fa5_]+)+"
匹配第一部分数字: "(?:-1|\d+)"
匹配第二部分减号后面文字: "[-a-zA-Z\u4e00-\u9fa5_]+"
匹配"1-WIFI-MAC_Match": "(?m)^-?\d-(.*?)$"
"\\d-[a-zA-Z_\u4e00-\u9fa5]+$" 这个只能匹配: 全匹配1-a 1-啥 1-_
几点基础: