Hi guys, I've got a column which stores the file name on it, the column is character varying(255). I'm selecting that value in a CTE query; basically:
test1 AS ( SELECT regexp_matches(name, '((main|medium).name/\d+.\d+)') as filename, * from test1; ) select filename[1] from test1 Example here: http://sqlfiddle.com/#!15/5f4f0/4 As you can see on the example: - if the file is a image (jpg), then it will have 2 variations (main|medium). - If the file is a pdf, then it will only have 1 variation (main). I basically need a regexp_matches expression that only gets me the file name, after the main.name/ for example. On the example I gave there are 2 problems: 1. I can only get the jpg file name 2. I don't get only the file name but the rest as well, which is not what I need How to do that? Thanks! Patrick