簡體   English   中英

oracle中REGEXP_LIKE中使用CARET符號有什么區別?

[英]What is the difference to use CARET symbol in REGEXP_LIKE in oracle?

我是 REGEX 的新手。 所以,我試過:

select * from ot.contacts where REGEXP_like(last_name,'^[A-C]');

另外,我試過:

select * from ot.contacts where REGEXP_like(last_name,'[A-C]');

他們都給了我輸出,其中 last_name 以 A、b、c 開頭,並且獲取的記錄數是相同的。你能告訴我什么時候可以看到使用這個插入符號的區別嗎?

在這種情況下, ^表示字符串的開頭。

  • '^[AC]'在字符串的開頭檢查 A、B 或 C。

  • '[AC]'檢查字符串中任意位置的 A、B 或 C。

根據您的數據集,兩個表達式可能會或可能不會產生相同的輸出。 以下是結果集不同的示例:

last_name         | ^[A-C]   | [A-C] 
----------------- | -------  | ----- 
Arthur            | match    | match
Bill              | match    | match
Jean-Christophe   | no match | match

暫無
暫無

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

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