正則在線測試工具:
https://tool.oschina.net/regex/
部分平臺正則表達式是以 / 開頭,鏈接這個不是,注意轉換平臺時加入或去掉開頭的/
待匹配字符串 "fds/hello world/im.test"
1. 測試結尾匹配 $:
表達式: .*.test$
含義:匹配任意以.test結尾的字符串,$跟在後面
結果:
這裏的結尾表示的是整個字符串的結尾:
2.與
修改world後不符合規則,匹配不到
3.或
4.非
修改world後匹配到