Regexp_replace question / help needed

Поиск
Список
Период
Сортировка
От Christopher Molnar
Тема Regexp_replace question / help needed
Дата
Msg-id CACU0s5VW3QD6r+-X4RQYcmBv9V8DNAmKswabtWKG6EMsk19FOA@mail.gmail.com
обсуждение исходный текст
Ответы Re: Regexp_replace question / help needed  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Regexp_replace question / help needed  (Nicolas Paris <niparisco@gmail.com>)
Re: Regexp_replace question / help needed  (Jerry Sievers <gsievers19@comcast.net>)
Список 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:


as a result.

Would anyone here point me in the right direction?

Thanks!
-Chris

В списке pgsql-general по дате отправления:

Предыдущее
От: Steve Crawford
Дата:
Сообщение: Re: Deletion Challenge
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Regexp_replace question / help needed