With the ~ operator, it is simple to find all lines in a table for which a column matches a given regexp pattern :
SELECT description from book where description ~ 'hell?o'
matches lines containing hello or helo
Instead of the description, I would like to SELECT a snippet of text around each occurences of the pattern, so if a line contains
description = "aaaheloaaabbbhellobbbcccheloccc"
I would like 3 lines as output :
"aaaheloaaa"
"bbbhellobbb"
"cccheloccc"
which I call a "grep-like" query because it can show extracts of the column where the match is found.