2

我正在尝试更改“www”。到“cdn”。对于 MySQL 数据库中的每个 img 元素。

这是 HTML 列,因此其中的其他元素(例如标签)有点棘手,a但我只想更改img标签

我已经尝试过LIKE '%test%',但不确定如何UPDATE用于这种情况

最好的方法是什么?

下面是一个例子:

 

[nivoslider id="1952"]

 

[one-third first]
<h2><a title="diet" href="http://www.test.com.au/diet">Diet and Nutrition</a></h2>
<a title="diet" href="http://www.test.com.au/diet"><img class="size-full wp-image-965 alignnone" title="diet-and-nutrition-information" alt="diet-and-nutrition-information" src="http://www.test.com.au/wp-content/uploads/2012/10/Optimized-diet-and-nutrition-information.jpg" width="310" height="220" /></a>
A dietitian provides assistance and education for every day meal and exercise plans and provides advice and modified diet plans to treat health and medical conditions. Our dietitian is here to educate you and your family about healthy ways of living to reduce or maintain a healthy weight, cholesterol levels and detoxify our bodies to live a longer, healthier, more active lifestyle. Combined with nutrition, our dietitian and nutritionist can assist with food intolerances, digestive system and eating disorders and sports nutrition. <a title="Diet and Nutrition" href="http://www.test.com.au/diet-and-nutrition/"><strong>Read more.</strong></a>[end-column]

[one-third]
<h2><a title="skincare" href="http://www.test.com.au/skincare">Skincare</a></h2>
<a href="http://www.test.com.au/skincare/"><img class="alignnone size-full wp-image-1793" title="skincare-information" alt="skincare" src="http://www.test.com.au/wp-content/uploads/2012/10/Optimized-skincare-information3.jpg" width="310" height="220" />
</a>Human skin is our body’s largest organ. It is a complex series of layers of cells and its function is to provide a natural barrier to many things. As with any other organ in the body, you should take care of your skin and keep it healthy. There are many basic skincare steps you can take throughout your life to keep your skin looking fresh and feeling good from cosmetics to natural procedures and techniques. Understanding, caring and treatment of skin conditions and diseases is an important part of skincare and your overall health. <strong><a title="Skincare" href="http://www.test.com.au/skincare/">Read more.</a></strong>[end-column]

[one-third last]
<h2><a title="speech-pathology" href="http://www.test.com.au/speech-pathology">Speech Pathology</a></h2>
<a title="speech-pathology" href="http://www.test.com.au/speech-pathology"><img class="size-full wp-image-967 alignnone" title="speech-pathology" alt="speech-pathology" src="http://www.test.com.au/wp-content/uploads/2012/10/Optimized-speech-pathology-information.jpg" width="310" height="220" /></a>
Speech and language pathology is concerned with issues surrounding human speech and language communication disorders. Assistance with producing words can be helpful to both children and adults who lack clear speaking skills. Conditions treated at ENT Wellbeing include cognitive-linguistic, oral motor, language, swallowing, stuttering, voice, and speech disorders. Our ENT Wellbeing speech pathologist will perform a comprehensive diagnosis so that an effective treatment plan can be customized for the patient. <strong><a title="Speech Pathology" href="http://www.test.com.au/speech-pathology/">Read more.</a></strong> [end-column]

[schemaLocalBusiness]

我在下面尝试过,但它不起作用:

UPDATE posts SET post_content = replace(post_content, 'src=\"http\:\/\/www\"', 'src=\"http\:\/\/cdn\"');
4

1 回答 1

1
update table set column = replace(column, 'www.', 'cdn.')
于 2012-12-23T02:28:06.710 回答