No question at this time
DBA Top 10
1 M. Cadot 23300
2 A. Kavsek 15200
3 M. Hidayathullah ... 11000
4 B. Vroman 8300
5 P. Wisse 6000
6 T. Boles 5000
7 J. Schnackenberg 3800
8 G. Lambregts 2200
8 P. Knibbs 2200
10 K. Van Nieuwenhov... 2100
About
DBA-Village
Download PLATO
The free tool for auditing and tuning your database
Version 55 now available
Sep 02, 2016
The DBA-Village forum
Forum as RSS
as RSS feed
Site Statistics
Ever registered users48039
Total active users1770
Act. users last 24h10
Act. users last hour1
Registered user hits last week205
Registered user hits last month1405
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, 11 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, 9 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