No question at this time
DBA Top 10
1 M. Cadot 15900
2 B. Vroman 15500
3 A. Kavsek 10000
4 T. Boles 6800
5 J. Schnackenberg 5800
6 M. Hidayathullah ... 3900
7 P. Wisse 1800
8 T. P 700
9 B. Derous 500
9 R. Wauben 500
9 H. Steijntjes 500
About
DBA-Village
The DBA-Village forum
Forum as RSS
as RSS feed
Site Statistics
Ever registered users48208
Total active users1645
Act. users last 24h7
Act. users last hour0
Registered user hits last week163
Registered user hits last month788
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, 284 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, 282 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