I am trying to come up with a regex to take the following string: 1:38P and convert it to a valid format for parsing in a date. I need to
- Check that the last character is either A or P, and if it is NOT, do nothing to the string.
- If the last letter is an A or P, then strip out that letter from the string, and prepend a Zero (0) to the string.
1 Answer