#!/bin/bash

re='^(master|release)'

for branch in release-foo-bar master-baz-quux devel-fnord-pizzazz other-gunk-tripe
do
    if [[ $branch =~ $re ]]; then
        echo "$branch matched $re"
    else
        echo "$branch did not match $re"
    fi
done