This formula will result in “am” or “pm”.
=REGEXEXTRACT(a1,"d+:dd (am|pm)")
How do I make it show everything and not just the captured group? I want it to behave like normal regex, which would show the whole match.
1
You don’t need a group, you can simplify the pattern by using a character class:
d+:dd [ap]m
And perhaps use word boundaries to prevent a partial match
bd+:dd [ap]mb
1
You can change the capture group into a non-capturing group:
=REGEXEXTRACT(a1,"d+:dd (?:am|pm)")