菜鸟求解:正则表达式 ^(/|.*'+includeUrl+') 该如何理解呢
python3吧
全部回复
仅看楼主
level 1
Daystar22 楼主
不太懂++!
2017年04月19日 14点04分 1
level 1
Daystar22 楼主
自己顶一下
2017年04月19日 14点04分 2
level 7
Some people, when confronted with a problem, think, “I know, I’ll use regular expressions.” Now they have two problems.
—Jamie “jwz” Zawinski, August 1997
2017年04月21日 07点04分 3
level 7
2017年04月21日 07点04分 4
level 7
2017年04月21日 07点04分 5
level 7
上面的是 《Python 核心编程》对正则的说明
2017年04月21日 07点04分 6
level 7
re.compile("^(/|.*"+includeUrl+")") 中的compile的参数 是一个字符串, 是要把一个正则形式的字符串转成正则,includeUrl是拼成这个字符串的一个变量, 这里面的加号是字符串的连接符号, 假如includeUrl的值为abc, 实际组成的正则是^(/|.*abc), 意思是匹配包括abc的字符串, 或者匹配以/开头的字符串, 你把"^(/|.*"+includeUrl+")"打印一下就都明白了
(复制粘贴自 https://zhidao.baidu.com/question/2077889045243301908.html
2017年04月21日 07点04分 7
爱你,谢谢!!
2017年04月26日 14点04分
[真棒]
2017年04月27日 16点04分
谢谢!终于理解了
2020年09月05日 12点09分
level 7
2017年04月21日 07点04分 8
1