[GENERAL] Regex help again (sorry, I am bad at these)

2015-12-29 Thread Christopher Molnar
Hello all!

Sorry to have to ask the experts here for some regex assistance again. I am
admittadly awful with these and could use some help.

Have the following string (this is an example) that needs to be changed.
Need to use a search and replace because the links across over 200K records
are similar but not the same.

'Complete the attached lab and submit via dropbox\rhttps://owncloud.porterchester.edu/HVACR/PCI_GasHeat/GasElectrical/HVACR1114_LAB_13A.pdf;
title="Lab 13A">Lab 13A<\a>'


Need the final string to separate the "LAB_13A.pdf" from the rest of the
URL by inserting a "=" in front of it. The final string should look
like:


'Complete the attached lab and submit via dropbox\rhttps://owncloud.porterchester.edu/HVACR/PCI_GasHeat/GasElectrical/=HVACR1114_LAB_13A.pdf;
title="Lab 13A">Lab 13A<\a>'


I have tried something like:

 update pcilms_assign set intro=regexp_replace(intro, '/([^/]*)\" title=$',
'=\1') where intro like '%https://owncloud.porterchester.edu%' and
course=18 and id=55413;

and the result puts the = in the wrong place (at the end of the whole
string).


Any suggestions?


Thanks!

-Chris


Re: [GENERAL] Regex help again (sorry, I am bad at these)

2015-12-28 Thread Christopher Molnar
Thank you Felix that was exactly what I needed!

-Chris

On Mon, Dec 28, 2015 at 2:23 PM, Félix GERZAGUET <felix.gerzag...@gmail.com>
wrote:

> Hello Chris,
>
> On Mon, Dec 28, 2015 at 8:10 PM, Christopher Molnar <
> cmol...@ourworldservices.com> wrote:
>
>> Any suggestions?
>>
> This seems to works:
>
> select regexp_replace('Complete the attached lab and submit via
> dropbox\rhttps://owncloud.porterchester.edu/HVACR/PCI_GasHeat/GasElectrical/HVACR1114_LAB_13A.pdf;
> title="Lab 13A">Lab 13A<\a>', '/([^/]*)\" title=', '/=\1" title=')
>
> Regards,
>
> Félix
>
>


[GENERAL] Regex help again (sorry, I am bad at these)

2015-12-28 Thread Christopher Molnar
Sorry to have to ask the experts here for some regex assistance again. I am
admittadly awful with these and could use some help.

Have the following string (this is an example) that needs to be changed.
Need to use a search and replace because the links across over 200K records
are similar but not the same.

'Complete the attached lab and submit via dropbox\rhttps://owncloud.porterchester.edu/HVACR/PCI_GasHeat/GasElectrical/HVACR1114_LAB_13A.pdf;
title="Lab 13A">Lab 13A<\a>'


Need the final string to separate the "LAB_13A.pdf" from the rest of the
URL by inserting a "=" in front of it. The final string should look
like:


'Complete the attached lab and submit via dropbox\rhttps://owncloud.porterchester.edu/HVACR/PCI_GasHeat/GasElectrical/=HVACR1114_LAB_13A.pdf;
title="Lab 13A">Lab 13A<\a>'


I have tried something like:

 update pcilms_assign set intro=regexp_replace(intro, '/([^/]*)\" title=$',
'=\1') where intro like '%https://owncloud.porterchester.edu%' and
course=18 and id=55413;

and the result puts the = in the wrong place (at the end of the whole
string).


Any suggestions?


Thanks!

-Chris


[GENERAL] regexp_replace question / help needed

2015-12-10 Thread Christopher Molnar
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 "=" while preserving the filename and
extension following the "/".

The closest I can get is:

regexp_replace('http://test.com/test/testfile.php','/[^/]*$','=')

however this looses the file name and returns:

http://test.com/test=

What I am looking for is:

http://test.com/test=testfile.php

as a result.

Would anyone here point me in the right direction?

Thanks!
-Chris


[GENERAL] Regexp_replace question / help needed

2015-12-09 Thread Christopher Molnar
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 "=" while preserving the filename and
extension following the "/".

The closest I can get is:

regexp_replace('http://test.com/test/testfile.php','/[^/]*$','=')

however this looses the file name and returns:

http://test.com/test=

What I am looking for is:

http://test.com/test=testfile.php

as a result.

Would anyone here point me in the right direction?

Thanks!
-Chris


Re: [GENERAL] Regexp_replace question / help needed

2015-12-09 Thread Christopher Molnar
Thank you both. Problem solved - worked perfectly.

On Wed, Dec 9, 2015 at 5:41 PM, Jerry Sievers <gsiever...@comcast.net>
wrote:

> Christopher Molnar <cmol...@ourworldservices.com> writes:
>
> > 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
> > "=" while preserving the filename and extension following the "/".
> >
> > The closest I can get is:
> >
> > regexp_replace('http://test.com/test/testfile.php','/[^/]*$','=')
> >
> > however this looses the file name and returns:
> >
> > http://test.com/test=
> >
> > What I am looking for is:
> >
> > http://test.com/test=testfile.php
> >
> > as a result.
> >
> > Would anyone here point me in the right direction?
>
>
> > select regexp_replace('http://foo/wow/blah/zzz.php', '/([^/]*)$',
> '=\1');
>   regexp_replace
> --
>  http://foo/wow/blah=zzz.php
> (1 row)
>
>
> >
> > Thanks!
> > -Chris
> >
>
> --
> Jerry Sievers
> Postgres DBA/Development Consulting
> e: postgres.consult...@comcast.net
> p: 312.241.7800
>