Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I use RegEx Buddy to prototype and debug my regular expressions. RegEx Buddy allows me to choose between a number of different regular expression engine types (.NET, Java, Perl, GNU BRE, GNU ERE, POSIX, BRE, POSIX ERE etc).

What regular expression engine does bash use (for example in if and case statements)? I'm running Centos 5.5 32 bit and bash 3.2.25(1):

[kevin@mon01 scratch]$ bash --version
GNU bash, version 3.2.25(1)-release (i686-redhat-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.

I'm guessing it'll be GNU BRE or GNU ERE?

share|improve this question

2 Answers 2

up vote 6 down vote accepted

bash (and POSIX shells in general) do not use regular expressions in the case statement, rather glob patterns.

There's limited support for regular expressions using the =~ operator; see details at: http://mywiki.wooledge.org/BashGuide/Patterns

share|improve this answer
Thanks. Second link mentions ERE which I am guessing is GNU ERE. –  Kev Jun 23 '11 at 9:03

According to the linked Bash guide, Bash (since version 3.0+) uses: "the Extended Regular Expression (ERE) dialect."

More information on that dialect can be found here.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.