| From: | Christopher Molnar <cmolnar65(at)gmail(dot)com> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | regexp_replace question / help needed |
| Date: | 2015-12-09 21:56:57 |
| Message-ID: | CACU0s5Uov201MEhvC=Vhk+1jBN-NPTfEiek0T1CvgGv7Wth7nw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Hello,
I am running into a problem and need some pointers on regexp_replace - I
can't seem to find an answer in any of the online resources.
I have a string (like 40,000 with different length and number of
components) of them in a field named "externalurl". I need to replace the
final "/" of the string with "&file=" while preserving the filename and
extension following the "/".
The closest I can get is:
regexp_replace('http://test.com/test/testfile.php','/[^/]*$','&file=')
however this looses the file name and returns:
What I am looking for is:
http://test.com/test&file=testfile.php
as a result.
Would anyone here point me in the right direction?
Thanks!
-Chris
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Christopher Molnar | 2015-12-09 21:58:45 | Regexp_replace question / help needed |
| Previous Message | Steve Crawford | 2015-12-09 21:45:52 | Re: Deletion Challenge |