第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

從記錄中刪除HTML標(biāo)簽

從記錄中刪除HTML標(biāo)簽

侃侃爾雅 2019-10-10 16:54:30
需要幫助從具有以下內(nèi)容的表一列構(gòu)成MYSQL查詢Row1 : this is first <a href='mytext.txt'>row</a> from the tableRow 2 : THis is the second row <img src ='mytext.jpg'> my image is thereRow 3 : <p>This is the Third row  my mytext is there  </p>Row 4 : <p class='te_mytext'>This is the Third row  my text is there  </p>這是表格行,我嘗試將關(guān)鍵字搜索為“ mytext”我的查詢是SELECT * from table  WHERE colmn_name ` like '%mytext%' "我將得到所有4行作為結(jié)果,但結(jié)果是錯(cuò)誤的。我只需要第3行就可以得到正確的輸出。之所以只在內(nèi)容中包含mytext的該行不在內(nèi)容中,而是在所有行中都具有mytext的原因,如何編寫MySQL查詢?
查看完整描述

3 回答

?
狐的傳說(shuō)

TA貢獻(xiàn)1804條經(jīng)驗(yàn) 獲得超3個(gè)贊

這是我對(duì)strip_tags函數(shù)的實(shí)現(xiàn):


CREATE FUNCTION `strip_tags`($str text) RETURNS text

BEGIN

    DECLARE $start, $end INT DEFAULT 1;

    LOOP

        SET $start = LOCATE("<", $str, $start);

        IF (!$start) THEN RETURN $str; END IF;

        SET $end = LOCATE(">", $str, $start);

        IF (!$end) THEN SET $end = $start; END IF;

        SET $str = INSERT($str, $start, $end - $start + 1, "");

    END LOOP;

END;

我確保它刪除了不匹配的左括號(hào),因?yàn)樗鼈兒芪kU(xiǎn),盡管它忽略了任何未配對(duì)的右括號(hào),因?yàn)樗鼈儫o(wú)害。


mysql> select strip_tags('<span>hel<b>lo <a href="world">wo<>rld</a> <<x>again<.');

+----------------------------------------------------------------------+

| strip_tags('<span>hel<b>lo <a href="world">wo<>rld</a> <<x>again<.') |

+----------------------------------------------------------------------+

| hello world again.                                                   |

+----------------------------------------------------------------------+

1 row in set


查看完整回答
反對(duì) 回復(fù) 2019-10-10
?
Smart貓小萌

TA貢獻(xiàn)1911條經(jīng)驗(yàn) 獲得超7個(gè)贊

這些行添加到fnStripTags功能

后SET Dirty = Insert( Dirty, iStart, iLength, '');


set Dirty = Replace(Dirty,'&nbsp;',''); #No space between & and nbsp;

set Dirty = Replace(Dirty,'\r','');

set Dirty = Replace(Dirty,'\n','');


查看完整回答
反對(duì) 回復(fù) 2019-10-10
  • 3 回答
  • 0 關(guān)注
  • 446 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)