我有一个文本字段。我需要识别模式<a href
和a>
之间的单词。
此模式可以位于文本的开头/结尾/中间。
with t as (
select '<a href Part of the technical Network Group www.tech.com/sites/ hh a>' as text from dual
union select '<a href www.tech.technical Network a>' as text from dual union
select 'www.tech.tech///technical <a href Network Group a>' as text from dual)
select * from t
WHERE REGEXP_LIKE(text,'(^|W)<a hrefS*','i')
这给了我前 2 行的结果,这是正确的。但是我需要检查单词"组"(不区分大小写(。我们如何检查"组"一词以及该词应该在模式中。在这种情况下,应返回第 1 行和第 3 行。
搜索完整的模式,然后在该模式的子字符串中搜索单词Group
。如果文本中有多个匹配项,则可以使用递归子查询分解子句来查找每个匹配项:
甲骨文设置:
CREATE TABLE table_name ( id, text ) AS
select 1, '<a href Part of the technical Network Group www.tech.com/sites/ hh a>' from dual union all
select 2, '<a href www.tech.technical Network a>' from dual union all
select 3, 'www.tech.tech///technical <a href Network Group a>' from dual union all
select 4, '<a hrefgroup a>' FROM DUAL UNION ALL
select 5, '<a href groupa>' FROM DUAL UNION ALL
select 6, '<a href workgroup a>' FROM DUAL UNION ALL
select 7, '<a href test1 a> Group <a href test2 a>' FROM DUAL;
查询:
WITH positions ( id, text, match, position ) AS (
SELECT id,
text,
REGEXP_SUBSTR(
text,
'(^|W)<a hrefs+.*?s+a>(W|$)',
1,
1,
'i'
),
REGEXP_INSTR(
text,
'(^|W)<a hrefs+.*?s+a>(W|$)',
1,
1,
0,
'i'
)
FROM table_name
UNION ALL
SELECT id,
text,
REGEXP_SUBSTR(
text,
'(^|W)<a hrefs+.*?s+a>(W|$)',
position + 1,
1,
'i'
),
REGEXP_INSTR(
text,
'(^|W)<a hrefs+.*?s+a>(W|$)',
position + 1,
1,
0,
'i'
)
FROM positions
WHERE position > 0
)
SELECT id,
text
FROM positions
WHERE REGEXP_LIKE( match, 'sGroups', 'i' );
输出:
身份证 |发短信 -: |:-------------------------------------------------------------------- 1 | 3 |www.tech.tech///technical
db<>fiddle here
你可以像这样扩展正则表达式:<a href.*group.*a>
.
DB小提琴上的演示:
with t as (
select '<a href Part of the technical Network Group www.tech.com/sites/ hh a>' as text from dual
union all select '<a href www.tech.technical Network a>' as text from dual
union all select 'www.tech.tech///technical <a href Network Group a>' as text from dual)
select * from t
WHERE REGEXP_LIKE(text,'<a href.*group.*a>','i')
|正文 | |:-------------------------------------------------------------------- | | | |www.tech.tech///technical相关内容
- 如何在oracle中使用正则表达式选择列包含两个以上单词的行
- Oracle 数据库中包含运算符不显示带有 *&?^$# 字符的单词
- Oracle过程返回count作为一个单词
- 如何使用Oracle替换列中大文本上的特定单词
- Oracle SQL -如何将字符串分成几个部分,但不分解单词
- 正则表达式捕获字符前的第一个单词,然后- oracle
- 如何从oracle plsql的字符串中获得第二个多于一个字母的最后一个单词
- oracle SQL提取特定单词前的单词
- 在oracle中从句子中提取单词
- Oracle SQL:检查指定的单词是否存在于逗号分隔的字符串中
- Oracle SQL-每70个字符拆分一个字符串,而不拆分一个单词和派生序列号
- 如何在Oracle中使用REGEXP_REPLACE删除单词
- 无法在Oracle列中搜索拼写错误的单词
- 在Oracle BI Publisher中将数字转换为单词
- 如何在Oracle SQL中按单词拆分字符串
- 如何在oracle中从空间中提取单词
- 计算Oracle 12c SQL列中不同单词的出现次数
- 使用Oracle的正则表达式功能可以查找标题包含三个或三个以上单词的所有电影
- 如何使用正则表达式识别特定模式之间的单词:Oracle?
- 如何将数字转换为单词- ORACLE
最新更新
- 我希望在表格单元格内的左、右位置的同一行中有不同的文本
- Entity Framework ExecuteDelete没有按预期工作
- 颤振只加载某些riv (.riv)文件
- Python问题我如何循环回我的代码?
- asyncpg.exceptions.InvalidAuthorizationSpecificationError Py
- 为什么我的阅读更多按钮不工作?
- 如何得到拆分字符后的单词
- 在列表框之间移动项
- 设置 SKEmitterNode 的 'targetNode' 会导致奇怪的 'zPosition' 行为
- 我无法在斐波那契数列 python 中加强术语
- 用Jest测试使用jquery获取数据的异步函数
- c#与HTML敏捷包不能得到div类的值
- Python 中的 OOP 层次结构
- 我如何动画下拉菜单的高度使用顺风css
- 无法从字符串比较失败的字符串中删除"—"
- 无法获取熊猫数据帧中的第一列值
- Odoo添加按钮应该重定向到我的模块视图
- r语言 - 我如何得到比例在数据表没有组号重复?
- 无法使用 conda env 导入 OCI 笔记本会话中的模型配置详细信息
- c - while循环中VSC的分段错误
- 无法将url数据获取到模型类中
- 如何将DataGridTextColumn绑定到WinUI3中绑定的对象中的方法?
- 错误在cobol程序上打开VB文件来处理XML文件
- while循环在python中没有爆发
- yii2查询具有多个非和或的数据提供程序
- Libgdx:渲染方法
- Pycharm 错误:预期类型 [类名] 改为"str"
- 运行我的代码时出现错误:未知的自定义元素
- 在Selenium 4中使用Behat和Mink Selenium2驱动程序为Microsoft Edge浏览器运行测试
- 宽度未知的可变列数
热门标签:
javascript python java c# php android html jquery c++ css ios sql mysql arrays asp.net json python-3.x ruby-on-rails .net sql-server django objective-c excel regex ruby linux ajax iphone xml vba spring asp.net-mvc database wordpress string postgresql wpf windows xcode bash git oracle list vb.net multithreading eclipse algorithm macos powershell visual-studio image forms numpy scala function api selenium