[R] pattern matching

Rui Barradas ruipbarradas at sapo.pt
Wed Oct 10 14:31:09 CEST 2012


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.




More information about the R-help mailing list