简体   繁体   English

oracle sql导航器数据挖掘文本挖掘

[英]oracle sql navigator data-mining text-mining

how can i search lets say FORMULA_TEXT field in a database where in between start and the end character of ' we have # or @ 我该如何搜索,假设数据库中的FORMULA_TEXT字段位于'开头和结尾字符之间,我们有#@

for example @A'123'HEY'345''@B'K 例如@A'123'HEY'345''@B'K

SO in this example we have 123 , 345 and @B in between start and the end of ' character so i want to find these with sql. 因此,在这个例子中,我们有123345@B在开始和结束之间'字,所以我想用sql找到这些。 lets say in each record i have this FORMULA_TEXT filed and i will check if it contains @ or # in between start and the and of ' character. 每条记录可以说我有这个FORMULA_TEXT申请,我会检查它是否包含@#在启动和与之间的'性格。

So in my example result is @B 所以在我的示例中结果是@B

By the way if its too hard I can first find @ s and then # s which are in between start and end ' character 顺便说一句,如果它太硬,我可以先找到@秒,然后# S的在开始和结束之间的'性格

ps: HEY is not in between start and the end of ' character in my example. ps:在我的示例中, HEY不在'字符的开头和结尾之间。

You can use REGEXP_SUBSTR : 您可以使用REGEXP_SUBSTR

SQL> SELECT txt, regex, regexp_substr(txt, regex, 1, 1, 'c', '3') result
  2    FROM (SELECT q'¤@A'123'HEY'345''@B'K¤' txt,
  3                 q'¤^([^']*|('[^']*')*?)*?'([^']*[@#][^']*)'¤' regex
  4            FROM dual);

TXT                  REGEX                                    RESULT
-------------------- ---------------------------------------- ---------
@A'123'HEY'345''@B'K ^([^']*|('[^']*')*?)*?'([^']*[@#][^']*)' @B

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM