[R] Number Regular Expressions

(Ted Harding) Ted.Harding at manchester.ac.uk
Wed Mar 4 10:30:25 CET 2009


On 04-Mar-09 07:55:11, Bob Roberts wrote:
> Hi,
>   I'm trying to write a regular expression that captures numbers in the
> form 9,007,653,372,262.48 but does not capture dates in the form
> 09/30/2005
> I have tried numerous expressions, but they all seem to return the
> dates as well. Thanks.

Testing the regular expression

  [0123456789,.][^/]*

with grep (on Linux, R is not involved in this test):

$ grep '[ ][0123456789,.][^/]*[ ]' << EOT
> A line with no numbers
> This is 9,007,653,372,262.48 one line
> Another no-numbers
> This is 09/30/2005 another line
> Yet another no-numbers
> EOT
This is 9,007,653,372,262.48 one line

Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 04-Mar-09                                       Time: 09:30:17
------------------------------ XFMail ------------------------------




More information about the R-help mailing list