1

I need to replace few selected html tags from string . Like for example let the string :

<B><SMALL>DSD-DNPH Color Cap Insert</SMALL></B>

and I did in following way :

REGEXP_REPLACE(name_text, '<[SMALL>]+>|<[/SMALL>]+>', '') 

But I want to remove all selected html tags like: <B>, <SMALL> and <FONT> .

Can you please suggest me to do this in single line for multiple selector.

1
  • And did that work? You say you DID IT that way. I don't believe you. [SMALL] will match ONE CHARACTER, S, M, A or L. It would delete the character S in DSD_NDPH. So... ?? Commented Nov 3, 2016 at 12:53

1 Answer 1

2

You can use the following construct to get rid of tags like constructs from string:

regexp_replace(name_text, '<.*?>')
Sign up to request clarification or add additional context in comments.

3 Comments

Hi @sebz thanks for your quick reply.but i want to remove only 3 html tags not all ie <B>,<SMALL> and <FONT>.Can you suggest any other solution.
Hi, In that case you can have 3 nested calls to replace each tag: REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(name_text, '<[SMALL>]+>|<[/SMALL>]+>', ''), '<[B>]+>|<[/B>]+>', ''), '<[FONT>]+>|<[/FONT>]+>', '') Is this feasible?
Awesome @sebz .Thanks for your help

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.