I am trying to insert "http://" on URL's that do not have it so links are created properly (and to ignore URL's with "https://"). I have the below, but it no worky. if (! $company_url =~ /^(http|https):\/\//) { $company_url = 'http://' . $company_url; } Code (markup):
Below seems to work... if ( $company_url =~ /^(http|https):\/\//) { } else { $company_url = 'http://' . $company_url; } Code (markup):
Hi there, I guess it has something to do with the operators precedence. in the 1st example the !$company_url is evaluated 1st, and at the ene the =~ is done. You can use if ( $company_url !~ /.../ ) or if ( !($company_url =~ /.../)) BR, Marcel