if [[ "$string" =~ ‹pattern› ]]; then
echo "Match found!"
else
echo "No match."
fi
pattern="[a-z]+"
if [[ "$string" =~ $pattern ]]; then
echo "Match found!"
else
echo "No match."
fi
filename="document.txt"
if [[ "$filename" =~ \.txt$ ]]; then
echo "Match found!"
else
echo "No match."
fi