[英]How to write oracle sql to look for special characters
I'm trying to search a varchar string for these specific characters.我正在尝试在 varchar 字符串中搜索这些特定字符。 ^$<>
I tried using regexp_like()
, but I can't figure out to only show the records that have those characters (since ^
and $
are used to determine something else in that function). ^$<>
我尝试使用regexp_like()
,但我无法弄清楚只显示具有这些字符的记录(因为^
和$
用于确定该函数中的其他内容)。
My data is a title field - so I only want to see the titles that have any of those characters.我的数据是一个标题字段 - 所以我只想查看包含任何这些字符的标题。 Thanks!谢谢!
You should use你应该使用
where col REGEXP_LIKE '[$^<>]'
Note that ^
is a negation marker when used as the first symbol inside a bracket expression, so it should be placed at the non-initial position.请注意,当用作括号表达式中的第一个符号时, ^
是一个否定标记,因此它应该放在非开头的 position 处。
Also, there is no need to add any .*
to the pattern since REGEXP_LIKE
is able to perform a partial match (ie there is no obligation to match the whole record).此外,由于REGEXP_LIKE
能够执行部分匹配(即没有义务匹配整个记录),因此无需在模式中添加任何.*
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.