Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

regex for url in bash

regex='^(https?|ftp|file)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]*[-A-Za-z0-9+&@#/%=~_|].[-A-Za-z0-9+&@#/%?=~_|!:,.;]*[-A-Za-z0-9+&@#/%=~_|]$'

url='http://www.google.com/test/link.php'
if [[ $url =~ $regex ]]
then 
    echo "$url IS valid"
else
    echo "$url IS NOT valid"
fi
Comment

PREVIOUS NEXT
Code Example
Shell :: how to checkout to another branch in git 
Shell :: get from match to end of file 
Shell :: ubuntu windows root directory 
Shell :: first 3 lines of a file 
Shell :: how to unzip ubuntu 2004 
Shell :: install influxdb 
Shell :: show install button for pwa react 
Shell :: install phpstan laravel 
Shell :: surge installation 
Shell :: create git repo 
Shell :: which linux 
Shell :: aws cli to increase the volume size 
Shell :: pulseaudio listen to microphone 
Shell :: kubernetes command kubectl 
Shell :: push image to docker hub 
Shell :: linux change user and group 
Shell :: how to pull a new remote branch 
Shell :: multi line comment in shell script 
Shell :: github accout change on vsc 
Shell :: how to use git in terminal 
Shell :: upgrade package using pip 
Shell :: bash test if in interactive shell 
Shell :: run redis server 
Shell :: install docker on linux debian 
Shell :: how to copy folder in linux 
Shell :: how to reduce the size of an image in linux 
Shell :: bash do while one line 
Shell :: The file AppDataRoaming pmyarn.ps1 is not digitally signed. 
Shell :: change branch git 
Shell :: installing font awesome brand icons 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =