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

regex extract all characters between a start and end string

I have strings that looks like this.

setting-bs_b77f423715d2b991-node
setting-bs_b77f423715d2b991-eggs
setting-bs_b77f423715d2b991-cheese
setting-bs_b14835f519bf447d-ham

How do I extract just the middle element? e.g. bs_b14835f519bf447dit is always the same length and always has the same bs_ prefix.

I unfortunately cannot use a lookbehind for this problem, as suggested in this answer as the regex must run inside bigquery which does not support lookbehinds

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

>Solution :

Assuming you have no other 16-char alphanumeric words then [a-z0-9]{16} could work.

https://regex101.com/r/6vhSH6/1

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