Heim >Backend-Entwicklung >PHP-Tutorial >javascript - 这个正则怎么匹配,又有%又有数字不确定位置
匹配这个地址券后9.9元秒杀链接:http://s.click.taobao.com/t?e=m%3D2%26s%3DlJP64KBy4n0cQipKwQzePOeEDrYVVa64qu1K02Mshg63bLqV5UHdqc1Z8EWGpjb8IfNVgZHErC4qC%2FWAES3KjEVAR5FF1Zuf0M83nhvB7wsgfuBp9F3RPIkDB4%2BhZGeu4jvn1Cnq4FRWJGtyXF33fb0bE%2FrR0l%2Fx0BLb%2BpKxka6%2BObly8YvHIpLMLhz%2Bon5e%2BUUq5xoumkE%3D
用这个http://s.click.taobao.com/(\w)(\?)?([\w\=\%])匹配出来少了kE%3D不知道什么鬼?
下面是原文
婕妤阁自然印象五色眼影点亮明眸,持久闪耀
券后9.9元包邮秒杀,纯福利!!
券后9.9元包邮秒杀,纯福利!!
30元电脑券:http://dwz.cn/2RbiD4
30元手机券:http://dwz.cn/2Rbidk
券后9.9元秒杀链接:http://s.click.taobao.com/t?e=m%3D2%26s%3DlJP64KBy4n0cQipKwQzePOeEDrYVVa64qu1K02Mshg63bLqV5UHdqc1Z8EWGpjb8IfNVgZHErC4qC%2FWAES3KjEVAR5FF1Zuf0M83nhvB7wsgfuBp9F3RPIkDB4%2BhZGeu4jvn1Cnq4FRWJGtyXF33fb0bE%2FrR0l%2Fx0BLb%2BpKxka6%2BObly8YvHIpLMLhz%2Bon5e%2BUUq5xoumkE%3D
款配色,总有一款适合爱美的你
匹配这个地址券后9.9元秒杀链接:http://s.click.taobao.com/t?e=m%3D2%26s%3DlJP64KBy4n0cQipKwQzePOeEDrYVVa64qu1K02Mshg63bLqV5UHdqc1Z8EWGpjb8IfNVgZHErC4qC%2FWAES3KjEVAR5FF1Zuf0M83nhvB7wsgfuBp9F3RPIkDB4%2BhZGeu4jvn1Cnq4FRWJGtyXF33fb0bE%2FrR0l%2Fx0BLb%2BpKxka6%2BObly8YvHIpLMLhz%2Bon5e%2BUUq5xoumkE%3D
用这个http://s.click.taobao.com/(\w)(\?)?([\w\=\%])匹配出来少了kE%3D不知道什么鬼?
下面是原文
婕妤阁自然印象五色眼影点亮明眸,持久闪耀
券后9.9元包邮秒杀,纯福利!!
券后9.9元包邮秒杀,纯福利!!
30元电脑券:http://dwz.cn/2RbiD4
30元手机券:http://dwz.cn/2Rbidk
券后9.9元秒杀链接:http://s.click.taobao.com/t?e=m%3D2%26s%3DlJP64KBy4n0cQipKwQzePOeEDrYVVa64qu1K02Mshg63bLqV5UHdqc1Z8EWGpjb8IfNVgZHErC4qC%2FWAES3KjEVAR5FF1Zuf0M83nhvB7wsgfuBp9F3RPIkDB4%2BhZGeu4jvn1Cnq4FRWJGtyXF33fb0bE%2FrR0l%2Fx0BLb%2BpKxka6%2BObly8YvHIpLMLhz%2Bon5e%2BUUq5xoumkE%3D
款配色,总有一款适合爱美的你
<code>import re url = 'http://s.click.taobao.com/t?e=m%3D2%26s%3DlJP64KBy4n0cQipKwQzePOeEDrYVVa64qu1K02Mshg63bLqV5UHdqc1Z8EWGpjb8IfNVgZHErC4qC%2FWAES3KjEVAR5FF1Zuf0M83nhvB7wsgfuBp9F3RPIkDB4%2BhZGeu4jvn1Cnq4FRWJGtyXF33fb0bE%2FrR0l%2Fx0BLb%2BpKxka6%2BObly8YvHIpLMLhz%2Bon5e%2BUUq5xoumkE%3D' m = re.match(r'http://s.click.taobao.com/(\w)(\?)?([\w\=\%]*)', url ) print m.group()</code>
我试了下,没有少 kE%3D 啊。你看看上面的代码。
先 urllib.parse.unquote()
一下?(Python 3.5)