|
|
OverviewAutomatically link to the sentenses starting from http://.
Flow
A sample codemy $url_pattern = 'https?:\/\/[\w\.~\/\?&\+=:@%;#\$%,\-]*'; $text =~ s/($url_pattern)/<a href=\"$1\">$1<\/a>/g;
Description of the codemy $url_pattern = 'https?:\/\/[\w\.~\/\?&\+=:@%;#\$%,\-]*'; Put the pattern to be searched into a variable. This process is not absolutely necessary. If the pattern match occurs multiple times in the script, it is recommended ot do just for convenience. $text =~ s/($url_pattern)/<a href=\"$1\">$1<\/a>/g; Replace URL patterns in $text by s///g. The pattern is used in <a href> tag and in between <a></a>. |