regex - Issue of Regular Expression for URL pattern on POSTGRES -


select regexp_replace('https://www.facebook.com/cricket/hello', '.*\..*?\/', '') 

the above code giving me

hello

instead of

cricket/hello

i checked on regexp checking website , pattern correct. not sure going wrong.

dbms: "postgresql 8.2.15 (greenplum database 4.2.8.3 build 1) on x86_64-unknown-linux-gnu, compiled gcc gcc (gcc) 4.4.2 compiled on nov 2 2014 01:33:14"

try this:

select regexp_replace('https://www.facebook.com/cricket/hello', '.*\.[a-z]+\/', '') 

also work cctld's :

select regexp_replace('https://www.google.co.uk/cricket/hello', '.*\.[a-z]+\/', '') 

Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -