match real number

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

match real number

Peng Yu
Hi,

I'm wondering if there is any built in regex to match real number? It
could make some application easier.

Thanks,
Peng
Reply | Threaded
Open this post in threaded view
|

Re: match real number

Tim Chase-2
> I'm wondering if there is any built in regex to match real number? It
> could make some application easier.


There aren't any builtin, and given that Vim doesn't have native
support for floating-point math, it's not surprising.  One can
use something like

        [-+]\=[0-9]*\.\=[0-9]\+\%([eE][-+]\=[0-9]\+\)\=

which should handle most of the common cases I've seen.

-tim