Hi All,
I have a string.
'<HTML><HEAD>THIS IS HEAD.</HEAD><BODY>THIS IS BODY.<P>THIS IS P1.</P>NIMISH<P>THIS IS P2.</P></BODY></HTML>'
I want to extract a html tag including its opening & closing tab with data as
if i say P1
then the output should be
'<P>THIS IS P1.</P>'
for P2
then the output should be
<P>THIS IS P2.</P>
please help me in writing this query with regular expression
i have tried it as following but it is not giving desired result:
WITH T AS
(
SELECT
'<HTML><HEAD>THIS IS HEAD.</HEAD><BODY>THIS IS BODY.<P>THIS IS P1.</P>NIMISH<P>THIS IS P2.</P></BODY></HTML>' STR
FROM
DUAL
)
SELECT REGEXP_SUBSTR(STR, '<P>.+P2.+</P>') FROM T
Thanks & Regards
Nimish Garg
Edited by: Nimish Garg on May 7, 2012 5:49 PM