簡體   English   中英

如何在定位中使用 MySql 正則表達式?

[英]How do use MySql Regex inside locate?

如果我嘗試在定位中使用正則表達式,它會失敗

Select Locate(FieldA regexp '[a-z][A-Z][a-z]',Binary FieldA) from  PatternTester

根據http://sqlfiddle.com/#!9/403c36/2

如果我搜索顯式字母模式,它會正確找到它:

Select Locate('lC',Binary FieldA) from  PatternTester 

根據http://sqlfiddle.com/#!9/403c36/6

我需要做些什么來定位“服從”正則表達式,還是根本不需要?

正如mysql 文檔所說, LOCATE()returns the position of the first occurrence of substring substr in string st ,因此它不會將任何正則表達式作為輸入參數。

同樣通過檢查您的小提琴參考,您在此版本中沒有REGEX_INSTR

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM