【问题标题】:Regex - find specific sequence of characters, some are not letters, digits or underscore正则表达式 - 查找特定的字符序列,有些不是字母、数字或下划线
【发布时间】:2022-09-27 21:27:12
【问题描述】:

我是正则表达式的新手,需要在 Impala 中的字符串字段中搜索与此确切字符序列的多个匹配项:~FC*

由于~* 不是字母或数字,我不确定如何以这个特定的顺序搜索它们,而不仅仅是出现这些单个字符。

到目前为止,这是我的代码,已经尝试过[~FC*]^~FC*$

这是一个测试字符串,它出现了 2 次:

N4*CITY*STATE*2155446*2120~FC*C*IND*30*MC*blah blah fjdgfeufh*27*0*****Y~FC*Z*IND*39*MC*jhlkfhfudfgsdkufgkusgfn*23*0*****Y~

    标签: sql regex impala


    【解决方案1】:
    .*(~FC\*).* or .*(\~FC\*).*
    
    .* - Zero or more characters
    .*(~FC\*).* - Means Search for ~FC* 
    
        
    
    if 1st one does not work, please try second one, it might work if tilde symbol is reserved in regex.
    

    【讨论】:

      猜你喜欢
      • 2010-09-25
      • 2015-04-28
      • 1970-01-01
      • 1970-01-01
      • 2012-08-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-10-01
      相关资源
      最近更新 更多