Solved

REPLACE a certain string in a certain field

Posted on 2014-04-15
2
196 Views
Last Modified: 2014-04-15
Hi there,

I have hundreds of  text strings in a specific field of a certain table with none or exactly these two "words": <semantics> and  </semantics>

I want to REPLACE the whole string presented, BUT excluding the two above "words" present at them, if it is the case.

Example: one possible data contained in the field is:

<p>Question 06: If  <math>   <semantics>    <mrow>     <mtext>&#8201;</mtext><mtext>&#8201;</mtext><mi>x</mi><mo>+</mo><mi>y</mi><mo>=</mo><mi>a</mi><mtext>&#8201;</mtext><mtext>&#8201;</mtext><mtext>&#8201;</mtext>    </mrow>    <annotation encoding='MathType-MTEF'>MathType@MTEF@5@5@+=feaagCart1ev2aqatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbwvMCKfMBHbqedmvETj2BSbqefm0B1jxALjhiov2DaerbuLwBLnhiov2DGi1BTfMBaebbnrfifHhDYfgasaacH84rpq0xbbf9q8WrFfeuY=Hhbbf9v8qqGqFr0xc9LqFj0lXxbba9Lqpepi0xhr=Fc9vqpeuj0lXdb9GqFj0dd9qqaqpi0xe9Gq=Fhrpe0dc8meaabaqaciaacaGaaeqabaWaaqaafaaakeaacaaMc8UaaGPaVlaadIhacqGHRaWkcaWG5bGaeyypa0JaamyyaiaaykW7caaMc8UaaGPaVdaa@46B9@</annotation>   </semantics>  </math> </p>

And I want to have it substituted by this one:

<p>Question 06: If  <math>    <mrow>     <mtext>&#8201;</mtext><mtext>&#8201;</mtext><mi>x</mi><mo>+</mo><mi>y</mi><mo>=</mo><mi>a</mi><mtext>&#8201;</mtext><mtext>&#8201;</mtext><mtext>&#8201;</mtext>    </mrow>    <annotation encoding='MathType-MTEF'>MathType@MTEF@5@5@+=feaagCart1ev2aqatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbwvMCKfMBHbqedmvETj2BSbqefm0B1jxALjhiov2DaerbuLwBLnhiov2DGi1BTfMBaebbnrfifHhDYfgasaacH84rpq0xbbf9q8WrFfeuY=Hhbbf9v8qqGqFr0xc9LqFj0lXxbba9Lqpepi0xhr=Fc9vqpeuj0lXdb9GqFj0dd9qqaqpi0xe9Gq=Fhrpe0dc8meaabaqaciaacaGaaeqabaWaaqaafaaakeaacaaMc8UaaGPaVlaadIhacqGHRaWkcaWG5bGaeyypa0JaamyyaiaaykW7caaMc8UaaGPaVdaa@46B9@</annotation>  </math> </p>

(Of course the bold ... is present only here, for the sake of clearness.)

Thanks,
fskilnik.
0
Comment
Question by:fskilnik
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 40

Accepted Solution

by:
Kyle Abrahams earned 500 total points
ID: 40001640
update table
set field = replace(replace(field, '<semantics>', ''), '</semantics>', '')

to test it out and make sure this is what you want:

select replace(replace(field, '<semantics>', ''), '</semantics>', '')
from table
0
 

Author Closing Comment

by:fskilnik
ID: 40001697
Perfect, Kyle! Thanks a lot.

Regards,
fskilnik.
0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question