#!/bin/bash regex='^2 (.*?)28 (.*?)$' program_out=$(./program) if [[ "$program_out" =~ $regex ]] then echo "PASS" $program_out else echo "FAIL " $program_out fi