Ultra Useful Regular Expression


# urlify - turn URL's into HTML links
my $text = "Check the website, http://www.oreilly.com/catalog/repr.";
$text =~ 
	s{
		b			# start at word boundary
		(			# capture to $1
		(https?|telnet|gopher|file|wais|ftp) :
					# resource and colon
		[w/#~:.?+=&%@!-] +?	# one or more valid
					# characters
					# but take as little as
					# possible
		)
		(?=			# lookahead
			[.:?-] *	# for possible punct
			(?: [^w/#~:.?+=&%@!-]	# invalid character
			  | $ )		# or end of string
		)
	}{<a href="$1">link</a>}igox;