use strict;
my $str = 'Title: Government URLs
Author: DigitalGov Search
Keywords:
Scope: Federal, state, local, tribal, and territorial government websites that aren\\\'t *.gov or *.mil.
Quarterly updates are also posted at https://github.com/GSA/govt-urls.
URI: http://govt-urls.usa.gov/tematres/vocab/
Powered by: TemaTres 1.63
Something: geekdrop.com
Catch 3 Slashes SSL: https:///
Catch 3 Slashes: http://
__________________________________________________________________________
1-800-vermont.com
created: 2013-06-06 19:11:14
Scope note: Travel and Tourism Site for Vermont
RTET: VermontVacation.com
BT: usagovVT
174.132.145.94/~hope
created: 2013-06-06 18:09:02
modified: 2013-11-20 15:27:15
Scope note: Town of Hope Mills, NC
BT: usagovNC
UF: townofhopemills.com
1800arkansas.com
USE: arkansasedc.com
1800runaway.org
created: 2014-01-10 19:15:25
Scope note: The National Runaway Safeline serves as the federally designated national communication system for runaway and homeless youth. Services are provided through funding from Family and Youth Services Bureau in the Administration for Children and Families, U.S. Department of Health and Human Services and the generosity of private funders (individual donors, corporate partners, and foundation grants).
BT: usagovQUASI
211.getcare.com
created: 2014-05-27 14:12:29
Scope note: 2-1-1 VIRGINIA is a service of the Virginia Department of Social Services provided in partnership with the Council of Community Services, the Family Resource and Referral Center, The Planning Council, the United Way of Central Virginia, and the United Way of Greater Richmond and Petersburg.
RT: 211virginia.org
BT: usagovVA
211virginia.org
created: 2014-01-10 19:17:31
Scope note: 2-1-1 VIRGINIA is a service of the Virginia Department of Social Services provided in partnership with the Council of Community Services, the Family Resource and Referral Center, The Planning Council, the United Way of Central Virginia, and the United Way of Greater Richmond and Petersburg.
RT: 211.getcare.com
BT: usagovVA
360eldorado.com/Government
created: 2013-11-19 12:54:52
Scope note: City of El Dorado, KS
RT: eldoks.com
BT: usagovKS
3riverscfc.org
created: 2013-06-06 18:08:14
Scope note: 3 Rivers/Pennsylvania West Combined Federal Campaign
BT: usagovOH
BT: usagovPA
BT: usagovWV
4thjudicialda.com
created: 2014-01-10 19:17:31
Scope note: 4th Judicial District Attorney
BT: usagovCO
511ny.org
created: 2014-01-24 14:33:30
Scope note: 511 NY (New York State Department of Transportation), the free, official one-stop, all-encompassing telephone and Web service offering information on transportation services and conditions throughout New York State.
BT: usagovNY
800alabama.com
USE: alabama.travel
911digitalarchive.org
created: 2013-06-06 18:08:14
Scope note: The September 11 Digital Archive (funded by a major grant from the Alfred P. Sloan Foundation and organized by the American Social History Project at the City University of New York Graduate Center and the Center for History and New Media at George Mason University)
BT: usagovQUASI
aacounty.org
created: 2013-06-06 18:08:14
Scope note: Anne Arundel County, MD
BT: usagovMD
aapcc.org
created: 2014-01-10 19:19:24
Scope note: American Association of Poison Control Centers
BT: usagovQUASI
aatwp.org
created: 2013-06-06 18:08:14
BT: usagovMI
aberdeen-md.org
created: 2013-06-06 18:08:14
Scope note: City of Aberdeen, MD
BT: usagovMD
aberdeen.sd.us
created: 2013-06';
my $regex = qr/([(http(s)?):\/\/(www\.)?a-zA-Z0-9@:%._\+~#=-]{2,256}\.[a-z]{2,6}|(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))\b([-a-zA-Z0-9@:%_\+~#?&\/\/=]*)|(http(s)?:\/\/\/?)/mip;
if ( $str =~ /$regex/g ) {
print "Whole match is ${^MATCH} and its start/end positions can be obtained via \$-[0] and \$+[0]\n";
# print "Capture Group 1 is $1 and its start/end positions can be obtained via \$-[1] and \$+[1]\n";
# print "Capture Group 2 is $2 ... and so on\n";
}
# ${^POSTMATCH} and ${^PREMATCH} are also available with the use of '/p'
# Named capture groups can be called via $+{name}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Perl, please visit: http://perldoc.perl.org/perlre.html