Information Technology Grimoire

Version .0.0.1

IT Notes from various projects because I forget, and hopefully they help you too.

Extract URI Using Perl Regexp::Common

I wanted to see the urls to several things and didn’t want any other text cluttering my notes. Perl to the rescue, specifically Regexp::Common.

There are several ways to get a URI, and Regexp::Common will get 99% of the URIs. It works for what I needed, and took 10 seconds to implement - so, here it is:


use warnings;
use strict;

use Regexp::Common qw/URI/;

while(<data>) {
	my $str = $_;
	my ($uri) = $str =~ /$RE{URI}{-keep}/;
	print $uri . "\n";


  <div><a href="">CISSP : Certified Information Systems Security Professional 2015</a></div>
  <div><a href="">CompTIA Security + SY0-401</a></div>
  <div><a href="">CompTIA  Advanced Security Practitioner (CASP)</a></div>
  <div><a href="">CompTIA Advanced Security Practitioner (CASP)</a></div>
  <div><a href="">Cisco 210-065: Implementing Cisco Video Network Devices (CIVND1 & CIVND2)</a></div>
  <div><a href="">CISSP: Certified Information Systems Security Professional 2015 </a></div>
  <div><a href="">Cisco 210-060: Implementing Cisco Collaboration Devices (CCID)</a></div>
  <div><a href="">Cisco 200-355: Implementing Cisco Wireless Networking Fundamentals</a></div>
  <div><a href="">Cisco 200-105 Interconnecting Cisco Networking Devices Part 2 - ICND2 v3</a></div>
  <div><a href="">Cisco 300 -115 - SWITCH - Implementing Cisco IP Switched Networks</a></div>
  <div><a href="">Cisco 300-135 - TSHOOT - Troubleshooting And Maintaining Cisco IP Networks</a></div>
  <div><a href="">CSA Certificate of Cloud Technology Security Knowledge (CCSK)</a></div>
  <div><a href="">Certified Information Systems Auditor (CISA)</a></div>
  <div><a href="">Certified Information Security Manager (CISM)</a></div>
  <div><a href="">Risk Management Professional (PMI-RMP) </a></div>
  <div><a href="">Cisco 300 -101 - ROUTE - Implementing Cisco IP Routing</a></div>
  <div><a href="">Cisco 210-260: Implementing Cisco Network Security</a></div>
  <div><a href="">Computer Hacking Forensic Investigator (CHFI)</a></div>
  <div><a href="">Cisco 100-105: Interconnecting Cisco Networking Devices Part 1 - ICND1 v3</a></div>
  <div><a href="">CompTIA CySA+  (Cyber Security Analyst)</a></div>
  <div><a href="">CompTIA Security+ SY0-501</a></div>
Last updated on 3 Jan 2019
Published on 3 Jan 2019