Skip to content
Back to formatted view

Raw Message

Message-ID: <50756A8D.1090803@sapo.pt>
Date: 2012-10-10T12:31:09Z
From: Rui Barradas
Subject: pattern matching
In-Reply-To: <1349869532730-4645688.post@n4.nabble.com>

Hello,

Try the following.

pattern <- "between [[:digit:]]+ to [[:digit:]]+"

re <- regexpr(pattern, string)
regmatches(string, re)

Hope this helps,

Rui Barradas
Em 10-10-2012 12:45, arunkumar1111 escreveu:
> hi
>
> My string contain
>
>
> string = "The sales is good when my num1 between 1 to 5 . else the sales is
> poor".
>
> i want to find the patten between 1 to 5 . between and to will be constant
> but the numbers would be changing. How to search for that pattern.
>
> Please help
>
>
>
> -----
> Thanks in Advance
>          Arun
> --
> View this message in context: http://r.789695.n4.nabble.com/pattern-matching-tp4645688.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.