#!/bin/bash re='^(master|release)' for branch in release-foo-bar master-baz-quux devel-fnord-pizzazz other-gunk-tripedo if [[ $branch =~ $re ]]; then echo "$branch matched $re" else echo "$branch did not match $re" fidone
Standard input is empty
release-foo-bar matched ^(master|release) master-baz-quux matched ^(master|release) devel-fnord-pizzazz did not match ^(master|release) other-gunk-tripe did not match ^(master|release)
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!