I'm trying to extract a street address in Google Sheets. In my data, the address is followed by either a comma(",") or the word "between" Having trouble writing a REGEXTRACT function that matches up to the comma OR the word
This is as close as I've gotten:
^(.*?)\s,|^(.*?)\sbetween
Which works fine for addresses preceding commas, but not preceding 'between'
Is there a way to write this so it essentially says 'match up to the first instance of X OR the first instance of Y"?
Thank you
You may use this regex pattern:
^(.*)?\s*(?:,|between)
This matches all content
^
from the start of the cell value(.*)?
match and capture everything until the nearest\s*
optional whitespace(?:,|between)
match ,
or the word between