Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 6
    In theoretical CS, a regular expression is a description of a regular language, which is one that can be recognized by a finite automaton. In the Unix world, it's much more complicated, and there is no single definition. There are 2 regex dialects in the POSIX spec: extended and basic, which are used by tools like grep, sed, and awk. Vim uses its own variety, as does Perl. Commented Aug 27, 2012 at 14:42
  • So, by that definition, a file glob is a BRE right? Commented Aug 27, 2012 at 14:52
  • 2
    Nope, a file glob is NOT a BRE - what makes you think it is? If you read the POSIX description of BRE and the POSIX description of globbing, you'll notice that they are not the same. For instance, * has two different meanings in BRE and globs. Note: I don't think the term glob is used anywhere in the POSIX spec - it's called Pattern Matching instead and is described in the shell language chapter. Commented Aug 27, 2012 at 14:58
  • See also Why does my regular expression work in X but not in Y? Commented Jun 5, 2017 at 23:19
  • Interestingly, Bash's extglob does include the ability to arbitrarily repeat sections, which means that technically it meets the definition of RegEx, though many people deny this because extglob's syntax is so radically different from BRE, ERE, PRCE and VimRE: repetition is indicated by prefix symbols rather than suffix symbols. Commented Jul 2, 2024 at 6:47