dbTalk Databases Forums  

REGEXP_SUBSTR question

comp.databases.postgresql.general comp.databases.postgresql.general


Discuss REGEXP_SUBSTR question in the comp.databases.postgresql.general forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Luc Giguere
 
Posts: n/a

Default REGEXP_SUBSTR question - 01-14-2013 , 03:07 PM






Hi,

I try to match different parts of a string delimited by '$$' followed by a letter.


Example of a string
$$aSingapore ;$$aHackensack, N.J. :$$bWorld Scientific Pub. Co.,$$cc2011.


Examples of regexp on the strings I tried
-1-
SELECT REGEXP_SUBSTR(z00r_text, '(\$\$a.*\$\$a)*') from z00r where substr(z00r_field_code,1,3) = '260' and rownum < 11;

REGEXP_SUBSTR(Z00R_TEXT,'(\$\$A.*\$\$A)*')
--------------------------------------------------------------------------------
$$aSingapore ;$$a


-2-
SELECT REGEXP_SUBSTR(z00r_text,'(\$\$a(.*)\$)*(\$\$)*') || ' ' || REGEXP_SUBSTR(z00r_text,'(\$\$c(.*)\$)*(\$\$)*') from z00r where substr(z00r_field_code,1,3) = '260' and rownum < 11;

REGEXP_SUBSTR(Z00R_TEXT,'(\$\$A(.*)\$)*(\$\$)*')|| ''||REGEXP_SUBSTR(Z00R_TEXT,'(
--------------------------------------------------------------------------------
$$aSingapore ;$$aHackensack, N.J. :$$bWorld Scientific Pub. Co.,$$ $$


-3-
SELECT REGEXP_SUBSTR(z00r_text,'(\$\$a.*\$\$[a^b-z]{1})',1,1,'i') from z00r where substr(z00r_field_code,1,3) = '260' and rownum < 11;

REGEXP_SUBSTR(Z00R_TEXT,'(\$\$A.*\$\$[B-Z]{1})',1,1,'I')
--------------------------------------------------------------------------------
$$aSingapore ;$$aHackensack, N.J. :$$bWorld Scientific Pub. Co.,$$c


Is there away with the REGEXP_SUBSTR function to get :

$$aSingapore ;$$aHackensack, N.J. :
or
$$bWorld Scientific Pub. Co.,
or
$$cc2011.

Thanks a lot,
Luc

--
Posted by Mimo Usenet Browser v0.2.5
http://www.mimousenet.com/mimo/post

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.