久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

      <legend id='kRiJ9'><style id='kRiJ9'><dir id='kRiJ9'><q id='kRiJ9'></q></dir></style></legend>

    1. <small id='kRiJ9'></small><noframes id='kRiJ9'>

      <i id='kRiJ9'><tr id='kRiJ9'><dt id='kRiJ9'><q id='kRiJ9'><span id='kRiJ9'><b id='kRiJ9'><form id='kRiJ9'><ins id='kRiJ9'></ins><ul id='kRiJ9'></ul><sub id='kRiJ9'></sub></form><legend id='kRiJ9'></legend><bdo id='kRiJ9'><pre id='kRiJ9'><center id='kRiJ9'></center></pre></bdo></b><th id='kRiJ9'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='kRiJ9'><tfoot id='kRiJ9'></tfoot><dl id='kRiJ9'><fieldset id='kRiJ9'></fieldset></dl></div>
      1. <tfoot id='kRiJ9'></tfoot>

          <bdo id='kRiJ9'></bdo><ul id='kRiJ9'></ul>

        如何在 MySQL 中進行正則表達式替換?

        How to do a regular expression replace in MySQL?(如何在 MySQL 中進行正則表達式替換?)
        • <bdo id='wZLCw'></bdo><ul id='wZLCw'></ul>
            • <small id='wZLCw'></small><noframes id='wZLCw'>

              <i id='wZLCw'><tr id='wZLCw'><dt id='wZLCw'><q id='wZLCw'><span id='wZLCw'><b id='wZLCw'><form id='wZLCw'><ins id='wZLCw'></ins><ul id='wZLCw'></ul><sub id='wZLCw'></sub></form><legend id='wZLCw'></legend><bdo id='wZLCw'><pre id='wZLCw'><center id='wZLCw'></center></pre></bdo></b><th id='wZLCw'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='wZLCw'><tfoot id='wZLCw'></tfoot><dl id='wZLCw'><fieldset id='wZLCw'></fieldset></dl></div>
                <legend id='wZLCw'><style id='wZLCw'><dir id='wZLCw'><q id='wZLCw'></q></dir></style></legend>

                  <tfoot id='wZLCw'></tfoot>
                    <tbody id='wZLCw'></tbody>
                1. 本文介紹了如何在 MySQL 中進行正則表達式替換?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我有一個大約有 50 萬行的表格;varchar(255) UTF8 列 filename 包含文件名;

                  I have a table with ~500k rows; varchar(255) UTF8 column filename contains a file name;

                  我試圖從文件名中去除各種奇怪的字符 - 我想我會使用一個字符類:[^a-zA-Z0-9()_ .\-]

                  I'm trying to strip out various strange characters out of the filename - thought I'd use a character class: [^a-zA-Z0-9()_ .\-]

                  現在,MySQL 中是否有一個函數可以讓您通過正則表達式進行替換?我正在尋找與 REPLACE() 函數類似的功能 - 簡化示例如下:

                  Now, is there a function in MySQL that lets you replace through a regular expression? I'm looking for a similar functionality to REPLACE() function - simplified example follows:

                  SELECT REPLACE('stackowerflow', 'ower', 'over');
                  
                  Output: "stackoverflow"
                  
                  /* does something like this exist? */
                  SELECT X_REG_REPLACE('Stackoverflow','/[A-Zf]/','-'); 
                  
                  Output: "-tackover-low"
                  

                  我知道REGEXP/RLIKE,但那些只檢查if是否匹配,而不是什么匹配.

                  I know about REGEXP/RLIKE, but those only check if there is a match, not what the match is.

                  (我可以做一個SELECT pkey_id,filename FROM foo WHERE filename RLIKE '[^a-zA-Z0-9()_ .\-]'" 從 PHP 腳本中,執行 preg_replace 然后"UPDATE foo ... WHERE pkey_id=...",但這看起來像是最后的緩慢&丑陋的黑客)

                  (I could do a "SELECT pkey_id,filename FROM foo WHERE filename RLIKE '[^a-zA-Z0-9()_ .\-]'" from a PHP script, do a preg_replace and then "UPDATE foo ... WHERE pkey_id=...", but that looks like a last-resort slow & ugly hack)

                  推薦答案

                  使用 MySQL 8.0+ 你可以原生使用 REGEXP_REPLACE 函數.

                  With MySQL 8.0+ you could use natively REGEXP_REPLACE function.

                  12.5.2 正則表達式:

                  REGEXP_REPLACE(expr, pat, repl[, pos[,occurrence[, match_type]]])

                  用替換字符串repl替換字符串expr中匹配模式pat指定的正則表達式的出現,并返回結果細繩.如果exprpatreplNULL,則返回值為NULL.

                  Replaces occurrences in the string expr that match the regular expression specified by the pattern pat with the replacement string repl, and returns the resulting string. If expr, pat, or repl is NULL, the return value is NULL.

                  和正則表達式支持:

                  以前,MySQL 使用 Henry Spencer 正則表達式庫來支持正則表達式運算符(REGEXPRLIKE).

                  Previously, MySQL used the Henry Spencer regular expression library to support regular expression operators (REGEXP, RLIKE).

                  正則表達式支持已使用 Unicode 國際組件 (ICU) 重新實現,該組件提供完整的 Unicode 支持并且是多字節安全的.REGEXP_LIKE() 函數以 REGEXPRLIKE 運算符的方式執行正則表達式匹配,它們現在是該函數的同義詞.此外, REGEXP_INSTR() REGEXP_REPLACE() REGEXP_SUBSTR() 函數可用于查找匹配位置并分別執行子字符串替換和提取.

                  Regular expression support has been reimplemented using International Components for Unicode (ICU), which provides full Unicode support and is multibyte safe. The REGEXP_LIKE() function performs regular expression matching in the manner of the REGEXP and RLIKE operators, which now are synonyms for that function. In addition, the REGEXP_INSTR(), REGEXP_REPLACE(), and REGEXP_SUBSTR() functions are available to find match positions and perform substring substitution and extraction, respectively.

                  SELECT REGEXP_REPLACE('Stackoverflow','[A-Zf]','-',1,0,'c'); 
                  -- Output:
                  -tackover-low
                  

                  DBFiddle 演示

                  這篇關于如何在 MySQL 中進行正則表達式替換?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How to use windowing functions efficiently to decide next N number of rows based on N number of previous values(如何有效地使用窗口函數根據 N 個先前值來決定接下來的 N 個行)
                  reuse the result of a select expression in the quot;GROUP BYquot; clause?(在“GROUP BY中重用選擇表達式的結果;條款?)
                  Does ignore option of Pyspark DataFrameWriter jdbc function ignore entire transaction or just offending rows?(Pyspark DataFrameWriter jdbc 函數的 ignore 選項是忽略整個事務還是只是有問題的行?) - IT屋-程序員軟件開發技
                  Error while using INSERT INTO table ON DUPLICATE KEY, using a for loop array(使用 INSERT INTO table ON DUPLICATE KEY 時出錯,使用 for 循環數組)
                  pyspark mysql jdbc load An error occurred while calling o23.load No suitable driver(pyspark mysql jdbc load 調用 o23.load 時發生錯誤 沒有合適的驅動程序)
                  How to integrate Apache Spark with MySQL for reading database tables as a spark dataframe?(如何將 Apache Spark 與 MySQL 集成以將數據庫表作為 Spark 數據幀讀取?)
                    <tbody id='cBe3Y'></tbody>
                      <bdo id='cBe3Y'></bdo><ul id='cBe3Y'></ul>
                      <i id='cBe3Y'><tr id='cBe3Y'><dt id='cBe3Y'><q id='cBe3Y'><span id='cBe3Y'><b id='cBe3Y'><form id='cBe3Y'><ins id='cBe3Y'></ins><ul id='cBe3Y'></ul><sub id='cBe3Y'></sub></form><legend id='cBe3Y'></legend><bdo id='cBe3Y'><pre id='cBe3Y'><center id='cBe3Y'></center></pre></bdo></b><th id='cBe3Y'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='cBe3Y'><tfoot id='cBe3Y'></tfoot><dl id='cBe3Y'><fieldset id='cBe3Y'></fieldset></dl></div>
                    • <tfoot id='cBe3Y'></tfoot>

                          <legend id='cBe3Y'><style id='cBe3Y'><dir id='cBe3Y'><q id='cBe3Y'></q></dir></style></legend>

                            <small id='cBe3Y'></small><noframes id='cBe3Y'>

                          • 主站蜘蛛池模板: 国产免费xxx | 91在线一区 | 国内精品视频在线观看 | 亚洲国产精久久久久久久 | 午夜精品久久久久久久星辰影院 | 国产精品色 | 精品自拍视频在线观看 | 天天干天天玩天天操 | 天天干,夜夜操 | 四虎影视一区二区 | 亚洲天堂久久新 | 国产精品a久久久久 | 欧美在线视频一区二区 | 99精品国产一区二区三区 | 暴草美女| 日韩欧美精品一区 | 国产一级一片免费播放 | 亚洲欧美激情精品一区二区 | 免费成人高清在线视频 | 国产一二区在线 | 黑人性hd| 久久国产精品视频 | 少妇午夜一级艳片欧美精品 | 国产美女一区二区 | 美女操网站 | 亚洲天堂精品久久 | 成人在线电影在线观看 | 人人天天操 | 久久综合久色欧美综合狠狠 | a级片在线观看 | 新超碰97 | 日韩精品一区二区三区视频播放 | 午夜免费成人 | 日韩亚洲欧美综合 | 国产黄色网址在线观看 | 成人av在线播放 | 国产一级片网站 | 欧美精品国产精品 | 罗宾被扒开腿做同人网站 | 视频在线观看亚洲 | 日韩电影在线一区 |