I've the following command that works good on my macOS;
git branch | egrep -v --regex "$REGEX_PATTERN" | xargs git branch -D
where the REGEX_PATTERN=(develop|master|release|).
When I change my regex into REGEX_PATTERN=^(develop|master|release|) to eliminate potentially embedded branch names, I can't get it working. So, I probably misuse the egrep but can't figure out how. That would be great if someone can point what might be the issue?
PS: I have another regex pattern that contains the very same ^ character which is passed over a find command and that works as expected.