From the course: PostgreSQL: Advanced Queries

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Pattern matching with regular expressions

Pattern matching with regular expressions - PostgreSQL Tutorial

From the course: PostgreSQL: Advanced Queries

Pattern matching with regular expressions

- [Instructor] If you need to locate text strings within the values stored in a database, then you could use a like operator. But a more powerful approach is to leverage regular expressions. Regular expressions provide a pattern-matching syntax that's used in a wide variety of programming languages. So like learning structured query language, taking the time to learn how regular expressions work will benefit you throughout your entire career in data science. I've opened the regular_expressions.txt file here, and we can see how to work with them in PostgreSQL. Regular expressions take a common prompt format. First, we have the input string that you want to search within, then a pattern matching operator, and, finally, the character sequence or the text that you want to find. The match operators all include the tilde character, and I have them listed out on lines 6 through 9. By itself, tilde will make a case-sensitive match to the character sequence. Adding an asterisk will make it…

Contents