[R] Number Regular Expressions

Gabor Grothendieck ggrothendieck at gmail.com
Wed Mar 4 10:31:34 CET 2009


Not clear what else is allowed to match and what not but this will
match strings of numbers commas and decimal points but not
match if there is anything else in the string like a slash:

regexpr("^[0-9.,]+$", "9,007,653,372,262.48")


On Wed, Mar 4, 2009 at 2:55 AM, Bob Roberts <quagmire54321 at yahoo.com> 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.
>
>
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>




More information about the R-help mailing list