In Google BigQuery, I have to list all tables that contain hours between 02 till 23 hour in their names.
Aka match any hour in this range [02->23], so I created the following regex:
([0-2][2-9])
But the problem is it will skip the hour 10 and 11, and REGEX_EXTRACT returns null value for those “unparsable?” tables.
I could try to match all hours first, then exclude hour 00 and 01. But I could’t find a way in regex to add them as exceptions..
([0-2][0-9])
What would you recommend/suggest in this case? Given that I can’t split this into 2 different regexes.
Thank you.
CodePudding user response:
You could write the pattern as
\b(?:0[2-9]|1\d|2[0-3])\b