From the course: Bash Patterns and Regular Expressions

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Comparing extended globs with regular expressions

Comparing extended globs with regular expressions - Bash Tutorial

From the course: Bash Patterns and Regular Expressions

Start my 1-month free trial

Comparing extended globs with regular expressions

- [Man] A lot of what we've talked about in this chapter may resemble regular expressions, which we'll talk about later in this course. I would like to briefly compare the two to help keep them straight. First, globs are generally for matching files. We can use them in for loops, if conditionals, case statements, and variable pattern matching, however their sole purpose is to extend globbing, that is to match files. Regular expressions match text. Maybe that text is the output of a command such as LS that lists files, however the output itself is text. Regular expressions are not designed to match files. We cannot use them in for loops or as globs on the command lane. Regular expressions have to be implemented by the command processing the text, such as grep, awk, sed, or Bash's in process regular expression matching with double square brackets. Let's compare the syntax. I think seeing the similarity will help you memorize both extended globs and extended regular expressions. I'll get…

Contents