From the course: Bash Patterns and Regular Expressions
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Comparing extended globs with regular expressions - Bash Tutorial
From the course: Bash Patterns and Regular Expressions
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
What are extended globs?5m 2s
-
(Locked)
Why you should use extended globs4m 37s
-
(Locked)
Make extended globs persistent1m 10s
-
(Locked)
Getting started with extended globs3m 4s
-
(Locked)
Pattern matching with extended globs5m 44s
-
(Locked)
Using extended globs with commands5m 1s
-
(Locked)
Comparing extended globs with regular expressions2m 22s
-
-
-
-
-
-
-
-