我需要Python中的正则表达式帮助。我有如下字符串:从字符串获取链接列表
17:25:31;http://example1.com/viewtopic.php?f=8&t=189;example1.com;127.0.0.1 2013-10-19
17:22:32;http://example2.com;example2.com;127.0.0.1 2013-10-19
20:18:28;http://example3.com/threads/example-text-in-url.27304/;example3.com;127.0.0.1 2013-10-19
我该如何得到这个列表?
['http://example1.com/viewtopic.php?f=8&t=189', 'http://example2.com', 'http://example3.com/threads/example-text-in-url.27304/']
虽然到测试的链接是很方便的,这是一个好主意,把你的正则表达式中有太多。例如,链接到期,如果链接断开,您的答案将不再有用。 – DSM
你完全正确!谢谢..! –
“{1}”完全是多余的。 – tripleee