No question at this time
DBA Top 10
1 B. Vroman 14500
2 M. Cadot 14200
3 A. Kavsek 6900
4 T. Boles 6100
5 J. Schnackenberg 5800
6 M. Hidayathullah ... 3600
7 G. Lambregts 1100
7 T. P 1100
7 P. Wisse 1100
10 B. Derous 500
10 R. Wauben 500
10 H. Steijntjes 500
About
DBA-Village
The DBA-Village forum
Forum as RSS
as RSS feed
Site Statistics
Ever registered users48226
Total active users1641
Act. users last 24h4
Act. users last hour0
Registered user hits last week340
Registered user hits last month1464
Go up

Regexp_substr - required last occurrence of string pattern
Next thread: LISTENER CONFIGURATION
Prev thread: Subsequent Addition of Hourly Data

Message Score Author Date
Hi All, I am trying to fetch any XML tag from t...... ankababu sayampu Sep 09, 2017, 17:20
Hello Ankababu, this is a simple search that do...... Bruno Vroman Sep 11, 2017, 18:03

Follow up by mail Click here


Subject: Regexp_substr - required last occurrence of string pattern
Author: ankababu sayampu, India
Date: Sep 09, 2017, 17:20, 315 days ago
Os info: Windows
Oracle info: 11.2
Message: Hi All,

I am trying to fetch any XML tag from the end of a string buffer. Below regular expression gives me the first occurrence of XML tag ie '<Test '. But I want to fetch '<TestInside ' tag. Please let me know Is there any way to find any last XML tag from last.

SELECT regexp_substr('<Test => <Test/><TestInside = Some Random Sentense','<+[[:alpha:]]+ ',1,1) FROM dual.

Thank,
Ankababu



Goto: Reply - Top of page 
If you think this item violates copyrights, please click here

Subject: Re: Regexp_substr - required last occurrence of string pattern
Author: Bruno Vroman, Belgium
Date: Sep 11, 2017, 18:03, 313 days ago
Message: Hello Ankababu,

this is a simple search that doesn't require REGEXPR...
COL string FOR A55

COL pos FOR 999
COL x FOR A15
WITH mydata AS
( SELECT '<Test => <Test/><TestInside = Some Random Sentense' string FROM dual
UNION ALL SELECT 'abc<Test1>def<Test2><Test3>ghi' FROM dual
UNION ALL SELECT 'abc<Test0>defghijklmnop' FROM dual
UNION ALL SELECT 'abc<other tag></Test is not present' FROM dual
)
SELECT string
, INSTR( string, '<Test', -1 ) pos
, SUBSTR( string, INSTR( string, '<Test', -1 ), 15 ) x
FROM mydata
;
STRING POS X
------------------------------------------------------- ---- ---------------
<Test => <Test/><TestInside = Some Random Sentense 17 <TestInside = S
abc<Test1>def<Test2><Test3>ghi 21 <Test3>ghi
abc<Test0>defghijklmnop 4 <Test0>defghijk
abc<other tag></Test is not present 0 abc<other tag><
Best regards,

Bruno Vroman.
Your rating?: This reply is Good Excellent
Goto: Reply - Top of page 
If you think this item violates copyrights, please click here