#!/bin/bash
# Regex is matched with the =~ operator
log='this is some content'
var='some'
reg=".* is ${var}.*"
if [[ $log =~ $reg ]]; then
echo 'matched'
fi
# Example to test if variable is a whole number
re='^[0-9]+$'
if ! [[ $yournumber =~ $re ]] ; then
echo "error: Not a number"
exit 1
fi