Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Regexp substr

babaraviOct 10 2019 — edited Oct 10 2019

Hi All,

I wanted to extract string from the message using regular expression. right now i used instr & substr to achieve my output.

but i wanted to try reg. exp.   can you please assist me to achieve the output.

first  extract the string between MED and SI 

second extract the string from first line to till "-"

third extract the string between "-" & "-"

MED

AA888/03.A6BMF.J32Y304.2/11

-AAA.187/121/1/1.0.T9441.2/6232.3/2490.4/560.5/159.PAX/21/288

.JMP/0.CRW/0.PAD/1/0

.JRR/0.CRW/0.PAD/1/0

-BBB.9/11/0/0.0.T9736.1/284.2/2827.3/968.4/5500.5/157.PAX/4/16

.JMP/0.CRW/0.PAD/0/0

SI PEK    FRE    2703    POS       7    BAG    5718    TRA 

MED

AA889/03.A6BMF.J32Y304.2/11

-AAA.197/121/1/1.0.T9441.2/6232.3/2490.4/560.5/159.PAX/21/288.JMP/0.CRW/0.PAD/1/0

-BBB.9/11/0/0.0.T9736.1/284.2/2827.3/968.4/5500.5/157.PAX/4/16.JMP/0.CRW/0.PAD/0/0

SI PEK    FRE    2703    POS       7    BAG    5718    TRA 

MED

AA999/03.A6BMF.J32Y304.2/11

-AAA.197/121/1/1.0.T9441.2/6232.3/2490.4/560.5/159.PAX/21/288.JMP/0.CRW/0.PAD/1/0

SI PEK    FRE    2703    POS       7    BAG    5718    TRA 

Expected output

col1                                              col2

AA888/03.A6BMF.J32Y304.2/11 -AAA.197/121/1/1.0.T9441.2/6232.3/2490.4/560.5/159.PAX/21/288.JMP/0.CRW/0.PAD/1/0.JRR/0.CRW/0.PAD/1/0

AA888/03.A6BMF.J32Y304.2/11 -BBB.9/11/0/0.0.T9736.1/284.2/2827.3/968.4/5500.5/157.PAX/4/16.JMP/0.CRW/0.PAD/0/0

AA889/03.A6BMF.J32Y304.2/11 -AAA.197/121/1/1.0.T9441.2/6232.3/2490.4/560.5/159.PAX/21/288.JMP/0.CRW/0.PAD/1/0

AA889/03.A6BMF.J32Y304.2/11 -BBB.9/11/0/0.0.T9736.1/284.2/2827.3/968.4/5500.5/157.PAX/4/16.JMP/0.CRW/0.PAD/0/0

AA999/03.A6BMF.J32Y304.2/11 -AAA.197/121/1/1.0.T9441.2/6232.3/2490.4/560.5/159.PAX/21/288.JMP/0.CRW/0.PAD/1/0

Comments
Post Details
Added on Oct 10 2019
3 comments
238 views