You need to add case intensive flag at the end:
myinput.match(/^\w*am\b$/i)
Edit: as per your comment
The issue with 07.15am
is the first part of your regex. If you want to be strict then you could try:
/^(\w+)(\.\w+)\s?(am)$/i
This will match 07.15am
, 07.15Am
or 07.15 AM
.
If you want to be a little looser you can make the second group optional.
/^(\w+)(\.\w+)?\s?(am)$/i
Also this wont work if you have anything before or after the string. I would suggest removing the ^$ boundaries.
/(\w+)(\.\w+)?\s?(am)/i
That should cover most cases.