Home > Blockchain >  regex extract all characters between a start and end string
regex extract all characters between a start and end string

Time:05-19

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

CodePudding user response:

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

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

  • Related