I tried follow but it can't work:
condition="^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\*\+,;=.]+$"
if [[ $1 =~ condition ]]
then
echo fine
else
echo bad
fi
It's used to determine whether the first param is valid.