#ensure there are no quotes arround the regex
if [[ "${DOMAINS}" =~ *..+ ]]; then ...
Use following structure:
if [[ $digit =~ [0-9] ]]; then //run if a digit included in $digit string
echo "$digit is a digit"
else
echo "oops"
fi
#!/bin/bash
if [[ "$date" =~ ^[0-9]{8}$ ]]; then
echo "Valid date"
else
echo "Invalid date"
fi