REGULAR_EXPRESSION query [message #632359] |
Thu, 29 January 2015 07:55 |
srinivas.k2005
Messages: 404 Registered: August 2006
|
Senior Member |
|
|
Hi,
I am not familiar with regular expression, can anybody give some suggestion on below
select REGEXP_REPLACE('test<img border="0" src="http://www.efunds.com/web/img/interface/logo.gif" width="105" height="45">674545', '<img+>') FROM DUAL;
So i have standard like any thing between <img border......> should be replaced by null
Output I need:
'test674545'
|
|
|
|
Re: REGULAR_EXPRESSION query [message #632363 is a reply to message #632362] |
Thu, 29 January 2015 08:11 |
Roachcoach
Messages: 1576 Registered: May 2010 Location: UK
|
Senior Member |
|
|
select REGEXP_REPLACE('test<img border="0" src="http://www.efunds.com/web/img/interface/logo.gif" width="105" height="45">674545', '<img(.)+>',null) FROM DUAL;
Works for the single test case.
Also, be very careful when using regexp - there are a lot of weird things happen there depending on settings.
|
|
|
|
|
|
|
Re: REGULAR_EXPRESSION query [message #632421 is a reply to message #632382] |
Fri, 30 January 2015 05:49 |
Roachcoach
Messages: 1576 Registered: May 2010 Location: UK
|
Senior Member |
|
|
Well the trouble is people typically oversimplify. There are literally countless threads on this forum where people post a question, a solution is posted and the immediate reply is "but that doesn't work for this case [which I've not told you about before]".
Which is why a detailed test case is good and why I caveated my initial reply.
|
|
|