Using regex to extract URLs from plain text with Perl

前端 未结 7 1961
梦如初夏
梦如初夏 2020-12-16 05:12

How can I use Perl regexps to extract all URLs of a specific domain (with possibly variable subdomains) with a specific extension from plain text? I have tried:



        
7条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-16 06:00

    URI::Find is specifically designed to solve this problem. It will find all URIs and then you can filter them. It has a few heuristics to handle things like trailing punctuation.

    UPDATE: Recently updated to handle Unicode.

提交回复
热议问题