Advanced Bash regex with examples - LinuxConfig.org

Using the power of regular expressions, one can parse and transform textual based documents and strings. This article is for advanced users, who are already familiar with basic regular expressions in Bash. For an introduction to Bash regular expressions, see our Bash regular expressions for beginners with examples article instead. Another article which you may find interesting is Regular Expressions in Python.

Ready to get started? Dive in and learn to use regexps like a pro!


This is a companion discussion topic for the original entry at https://linuxconfig.org/advanced-bash-regex-with-examples

The article title is a bit misleading. This really has nothing to do with the bash shell. You are just calling other linux tools from bash, but they can be called from sh, csh, zsh, or any other shell as well.

Agree with b-jazz, especially since Bash has its own regex system, using =~ and $BASH_REMATCH. And if you’re going to discuss regex in the Linux CLI, grep probably deserves a mention.