humingcheng / study_notes

The only significance of notes is to reduce the cost of acquiring knowledge.
0 stars 0 forks source link

正则表达式使用 #8

Open humingcheng opened 8 years ago

humingcheng commented 8 years ago

变量命名,首字符为小写、下划线,其余字符为字母、下划线,总长度1-10: ^[a-z][a-zA-Z]{0,9}$ 解析:^匹配字符串开头,$匹配字符串结尾。这是检查整个字符串是否匹配。

匹配2个'love':(love){2} 匹配0个或多个:{0,} 匹配至少1个:{1,} 匹配至多2个:{0,2} 匹配1-3个:{1,3}

未用到,未解决: 含'love'且含'unix' 含'love'且不含'unix'