在Mysql的html标记中查找并替换子字符串中的url

时间:2019-03-18 15:50:36

标签: mysql

我尝试了很多,但没有成功。我在数据库中存储了 content (长文本)列。因此,我想查找所有出现的 https://curious-api.example.pro 并将其替换为 {{3 }} 。提前致谢。这是内容:

<section id="jumbotron" style="background-image: url(https://curious-api.example.pro/fixture-images/images/label_appointment_scheduling.jpg);">

</section>

<section id="solutions-article">
    <div id="" class="content-aside-image img-left">
        <div class="row no-gutters">
            <div class="col col-12 col-md-6 image">
                <figure><img src="https://curious-api.example.pro/fixture-images/images/as_what_we_do.jpg" width="100%" alt="car" /></figure>
            </div>
            <div class="col col-12 col-md-6 content">
                <p>Curious Inc helpt u en uw bedrijf om uw planning te optimaliseren. Wij bieden uw medewerkers en uw klanten de mogelijkheid om uw agenda’s in te zien en desgewenst zelf te plannen. Wij koppelen de planning aan uw dienstverlening. Communicatie met uw klanten over de agenda en uw dienstverlening verloopt eenvoudiger, u integreert moeiteloos uw planning aan uw boekhouding en met slimme rapportages optimaliseert u uw processen. </p>
                </div</div>
            </div>
</section>
<section id="solution-showcases">
    <div class="container-fluid">
        <div class="row">
            <div class="card basic transparent disable-hover">
                <div class="card-inner">
                    <div class="card-image"><img src="https://curious-api.example.pro/fixture-images/images/CUR 003 Iconen labels_Agenda Planning.svg" alt="1" /></div>
                    <div class="card-body">
                        <h4 class="card-title">Slim plannen in de agenda</h4>
                        <p class="card-text">Ga slimmer om met vrije momenten. Krijg inzage in de agenda op mobiele telefoon, tablet en PC, plan sneller door automatische controle op beschikbaarheid van mens en middelen.</p>
                    </div>
                </div>
            </div>
            <div class="card basic transparent disable-hover">
                <div class="card-inner">
                    <div class="card-image"><img src="https://curious-api.example.pro/fixture-images/images/CUR 003 Iconen labels_Communicatie.svg" alt="2" /></div>
                    <div class="card-body">
                        <h4 class="card-title">Klantbeheer en communicatie</h4>
                        <p class="card-text">Verbeter uw service en communiceer proactief over de planning en uw dienstverlening met uw klanten. Onze producten werken met app, social media, sms, e-mail en webportaal.</p>
                    </div>
                </div>
            </div>
            <div class="card basic transparent disable-hover">
                <div class="card-inner">
                    <div class="card-image"><img src="https://curious-api.example.pro/fixture-images/images/CUR 003 Iconen labels_Boekhouding.svg" alt="3" /></div>
                    <div class="card-body">
                        <h4 class="card-title">Administratie en optimalisatie</h4>
                        <p class="card-text">Factureer automatisch op basis van geleverde diensten, koppel met uw boekhoudpakket en verkrijg rapportages die u helpen om nog slimmer te werken.</p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>


<section class="section-customer-stories">
            <div class="container-fluid">
                <figure class="customer-image"><img src="https://curious-api.example.pro/fixture-images/images/sander_borsten.png" alt="" /></figure>
                <figure class="customer-logo"><img src="https://curious-api.example.pro/fixture-images/images/logo_anwb.jpg" height="65" alt="" /></figure>
            </div>
        </article>
    </section>
</section>

2 个答案:

答案 0 :(得分:0)

MYSQL https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/CognitoIdentityServiceProvider.html 怎么样?

UPDATE your_tbl_name SET content = REPLACE(content,'https://curious-api.example.pro','http://localhost')

您还可以使用(可选) WHERE子句(例如

)来加快处理速度
UPDATE your_tbl_name SET content = REPLACE(content,'https://curious-api.example.pro','http://localhost') WHERE content LIKE '%https://curious-api.example.pro%'

如果要在mysql 5.7上替换正则表达式,可以尝试以下操作:replace()

答案 1 :(得分:0)

使用replace()

UPDATE table_name SET content = REPLACE(content, 'https://curious-api.example.pro', 'http://localhost')