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.
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.
This looks like a conceptual question rather than a R question. PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Arun Prasad Gurubaramurugeshan, Senior Research Analyst -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of arunkumar1111 Sent: Wednesday, October 10, 2012 6:46 AM To: r-help at r-project.org Subject: [R] pattern matching 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.