Search for the complete pattern and then search for the word Group
within the substring of that pattern. If there are be multiple matches within the text then you can use a recursive sub-query factoring clause to find them each:
Oracle Setup:
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;
Query:
WITH positions ( id, text, match, position ) AS (
SELECT id,
text,
REGEXP_SUBSTR(
text,
'(^|\W)<a href\s+.*?\s+a>(\W|$)',
1,
1,
'i'
),
REGEXP_INSTR(
text,
'(^|\W)<a href\s+.*?\s+a>(\W|$)',
1,
1,
0,
'i'
)
FROM table_name
UNION ALL
SELECT id,
text,
REGEXP_SUBSTR(
text,
'(^|\W)<a href\s+.*?\s+a>(\W|$)',
position + 1,
1,
'i'
),
REGEXP_INSTR(
text,
'(^|\W)<a href\s+.*?\s+a>(\W|$)',
position + 1,
1,
0,
'i'
)
FROM positions
WHERE position > 0
)
SELECT id,
text
FROM positions
WHERE REGEXP_LIKE( match, '\sGroup\s', 'i' );
Output:
ID | TEXT
-: | :--------------------------------------------------------------------
1 | <a href Part of the technical Network Group www.tech.com/sites/ hh a>
3 | www.tech.tech///technical <a href Network Group a>
db<>fiddle here