How to extract all characters after the first match, without including the first match

I have these strings, and I’m looking to extract all characters after the first _. For example:

'hello _I _ am _ 123312'
'Nobody sa_dwdq casc_as _ 1233_12'
'_dosjadojs aod jao jdaso j'

The output expected:

' I _ am _ 123312'
'dwdq casc_as _ 1233_12'
'dosjadojs aod jao jdaso j'

This is the closest answer I found, but it’s not in BigquerySQL language.

And this is what I have got so far, but it includes the matched character and I haven’t found a way to not include the matched character through regex:

REGEXP_EXTRACT(str, r'_.*')

>Solution :

Here is one way to do it,

https://regex101.com/r/voPDE5/3

_(.*)
_ : Non Capturing group, matching exactly one occurrence of "_"  
(.*) : Captures the remainder of the string

Leave a Reply