A Quick Look at PostgreSQL’s REGEXP_COUNT() Function

In PostgreSQL, the regexp_count() function returns the number of times a given POSIX regular expression pattern matches in a given string.

We pass the string and pattern as arguments. We can also pass an argument to specify where to start the search. Additionally, we also have the option of specifying a flag that changes the function’s behaviour.

Continue reading

Understanding the BTRIM() Function in PostgreSQL

PostgreSQL has a function called btrim() that we can use to trim both sides of a string. We can trim blank spaces or we can specify certain characters to trim.

It removes the longest string containing only characters from the ones we specify. If we don’t specify any characters, then it removes blank spaces from both sides.

We provide the string as the first argument, and the (optional) characters as the second.

Continue reading