Q:

Regexp_extract everything after appearance of '-q_'

Have strings containing 'q_' which I want to extract everything that comes after it. Some rows contain occurrence of q_ which I want everything that occurs after it. Example values in the column are: 
prod-q_cat_trait_cat_social_issue
_prod-q_body_modification_graffiti
event_tickets
dappled_grey
_prod-q_cat_tech_support

What is wrong with my regular expression as I'm trying to remove the trailing '_' after q. 
REGEXP_EXTRACT(queue_id, '[^q_]+$')

Is just returning
issue

I've also tried the split method:
SPLIT(queue_id, 'q_')[OFFSET(2)]

But this returns 
Array index 2 is out of bounds (overflow)

Any suggestions. Thanks! (I am using Google Cloud SQL)

A:

Using a capturing group, you may extract all after the first q_ with:
REGEXP_EXTRACT(queue_id, 'q_(.*)')

You may extract all after the last q_ with:
REGEXP_EXTRACT(queue_id, '.*q_(.*)')

See the regex demo #1 and regex demo #2.
Here, q_ finds the first occurrence of q_ and (.*) grabs the rest of the line into Group 1, and this is the value returned by REGEXP_EXTRACT. .* matches any 0+ chars other than line break chars as many as possible, that is why the second regex will start capturing the rest of the line after the last occurrence of q_.

