Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to remove the date / time stamp from text in the following format:

Randomtext - randomtext                             9 Aug 5:55am
2nd line of random text - 2nd randomtext            15 Aug 12:20am
More random text - some more text                   15 Aug 3:37pm

I'm having trouble with the date / time lengths being inconsistent due to the lack of leading zeros.

share|improve this question
up vote 1 down vote accepted

Try \b\d{1,2} (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Sept|Oct|Nov|Dec) \d{1,2}:\d\d(am|pm)\bwith the regular expression find/replace - this should match the timestamps as presented in the example. This will look for one or two digits for the day of the month and the hour, which will allow for both 09 and 9 formats.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.