How to not extract when it contain some string

I used function regexp_extract_all() and regexp_like() in presto.

  1. The substring that I need is a sequence of reject (1/2/3/4).
  2. I want to extract reject comment to team #AP or team name not exists only (not extract #AP ADMIN).

Note: Sometime user forget to use spacebar between words/team name/# e.g. #APADMIN.

Example:

Sentence: #APREJECTED1 #AP Do not use this paper bc bra bra with code123548.

The result that I want: 1

But sometimes user send 2 rejects for 2 team within 1 comment.

Sentence: #APREJECTED1 #AP Do not use this paper bc bra bra with code123548.#APREJECTED1 #AP ADMIN Do not use this paper code1fsdf48.

The result that I want: 1

Sentence: #APREJECTED3 #APADMIN AP ADMIN Please do not use this paper bc bra bra with code123548.#APREJECTED2 #AP AP Do not use this paper please send it to AP.

The result that I want: 2

Sentence: #APREJECTED #APADMIN Please do not use this paper code123548.#APREJECTED Do not use this paper please send it to AP.

**The result that I want: 1

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum