Example on dlang.org // Round floating point numbers

Dmitry Olshansky via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 16 05:23:06 PDT 2016


On 16-Jun-2016 14:55, Martin Tschierschke wrote:
> The example
> // Round floating point numbers
>
> with the floating point substitution using the Regex:
>
>  reFloatingPoint = ctRegex!`[0-9]+\.[0-9]+`;
>

To something like `[0-9]+\.[0-9]+(?![^.])`

> Is not so nice, because it would match for dates like 16.06.2016, too.
>
> (I remember having a simmilar problem when trying to substitute 123.44
> Euro to
> German format: 123,44 Euro ending up with a modified date: 16,06.2016)
>
> Sure this may be not the point of the example, but I dislike it therefore.
>
> How to expand the Regex not to match dates?
>
> Regards
> martin


-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list