[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Regex replace for numbers
From: |
Marcin Borkowski |
Subject: |
Re: Regex replace for numbers |
Date: |
Fri, 03 Oct 2014 03:07:59 +0200 |
On 2014-10-03, at 02:33, Robert Thorpe wrote:
> I'm not very good with Emacs regex, I need to search-and-replace on some
> numbers.
>
> How can I detect unnecessary zeros at the end of a number and chop them
> off? E.g. turn 567.45000 to 567.45 without also turning 6700 to 67.
What about
M-%
\([0-9]+\)\.\([0-9]*?\)0+ RET
\1.\2 RET
?
> BR,
> Robert Thorpe
Hth,
--
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Adam Mickiewicz University