Search
 
SCRIPT & CODE EXAMPLE
 

PHP

PHP validation/regex for URL

function validateURL($URL) {
      $pattern_1 = "/^(http|https|ftp)://(([A-Z0-9][A-Z0-9_-]*)(.[A-Z0-9][A-Z0-9_-]*)+.(com|org|net|dk|at|us|tv|info|uk|co.uk|biz|se)$)(:(d+))?/?/i";
      $pattern_2 = "/^(www)((.[A-Z0-9][A-Z0-9_-]*)+.(com|org|net|dk|at|us|tv|info|uk|co.uk|biz|se)$)(:(d+))?/?/i";       
      if(preg_match($pattern_1, $URL) || preg_match($pattern_2, $URL)){
        return true;
      } else{
        return false;
      }
    }
Comment

PREVIOUS NEXT
Code Example
Php :: laravel range query 
Php :: wordpress get page number 
Php :: cannot use font awesome in php mvc 
Php :: How to check if email exists in laravel validaton 
Php :: phpmyadmin reset auto_increment 
Php :: wp tax_query in 
Php :: php exponential operator 
Php :: laravel 8 check if record exists 
Php :: prettier with php 
Php :: laravel create db 
Php :: laravel pass variables to view 
Php :: laravel starter kit installation 
Php :: laravel folder permission 
Php :: php if negative make positive 
Php :: php unique id 
Php :: php check if class exists 
Php :: composer_update 
Php :: regex get text between braces 
Php :: laravel set session timeout 
Php :: how to get event dates on change in datetimepicker with laravel livewire 
Php :: laravel fortify 
Php :: laravel create model and migration 
Php :: php read csv 
Php :: Adding data to a laravel collection 
Php :: laravel automatically generate unique username 
Php :: file upload in php mysql 
Php :: laravel eloquent orderby 
Php :: wordpress log errors 
Php :: how to make zip in php by multiple files 
Php :: display image from database in laravel 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =