Hello everybody I'd like to match exactly numbers from 1 to 27. I've tried a character class like [1-27], but it matches 1,2 and 7. How to tell R (pcre) to interpret 27 "correctly"? Have been fastly looking throughout pcre man pages, without success. Many thanks Luca
Luca Braglia-2 wrote:> > I'd like to match exactly numbers from 1 to 27. >If you feel in masochistic mode, you can do it: b = c("32","3","17","27","28","57","a13") a = c("^([0-9]|[0-1][0-9]|2[0-7])$") grep(a,b,value=TRUE) A much more flexible way would be to isolate the numeric part first, and test for the range in a seconde step. Dieter -- View this message in context: http://www.nabble.com/help-with-regexps-tp25783202p25783948.html Sent from the R help mailing list archive at Nabble.com.