No question at this time
DBA Top 10
1 M. Cadot 17900
2 A. Kavsek 15700
3 M. Hidayathullah ... 9200
4 B. Vroman 8100
5 T. Boles 4900
6 P. Wisse 4700
7 J. Schnackenberg 3800
8 K. Van Nieuwenhov... 2100
9 G. Van Cauter 1400
10 A. Hudspith 800
10 T. P 800
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 users48078
Total active users1704
Act. users last 24h12
Act. users last hour0
Registered user hits last week397
Registered user hits last month1835
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, 69 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, 67 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