Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading