#!/bin/bash
test="foo@bar:/here/path/"
regex='^([[:alnum:]_.-]+)@([[:alnum:]_.:-]+):[~./]'
if [[ "$test" =~ $regex ]]; then 
    echo "yes, remote host" 
else 
    echo "no, local"
fi