0

I have this line:

;Last updated: Sunday, January 23, 2011

I would like to replace the date with the current time. So, I used replace-regxp with the following key combinations:

M-x replace-regexp RET \(Last updated: \)[A-Z ,]*[0-9 ,]* RET \1\,(format-time-string "%A, %B %e, %Y")

But this yields the following result:

;Last updated: Tuesday, January 25, 2011unday, January 23, 2011

How can I get replace-regexp to replace the whole of the old date instead of just the first letter?

2 Answers 2

2

Your regex only matches upper case letters. Since the u in Sunday is lower case, it only matches Last updated: S, so that's all that gets replaces.

To fix this add a-z to the character range.

Sign up to request clarification or add additional context in comments.

Comments

0

You're asking for only capital letters.

Try this:

M-x replace-regexp RET \(Last updated: \)[a-zA-Z ,]*[0-9 ,]* RET \1\,(format-time-string "%A, %B %e, %Y")

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.