Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.