Regex to match any of the following - "a","p"," am"," pm", etc
debugging, regex, syntax
Solution
/^(\d{1,2}):(\d{2})(\s*[ap]m?)$/i
The main change is the asterisk (`*`) after `\s`. It means - allow any number of whitespaces, or no whitespaces.
Problem
I'm looking for regex that will match "a","p"," a"," p","am","pm"," am"," pm". Note that what I'm looking for is whitespace agnostic. I have a regex grouping within a string, what I have right now, that is not working for a/m/am/pm is this: `/^(\d{1,2}):(\d{2})(\s(am|pm|a|p)$)/i;`