Re: [R] stringr package question

2015-08-13 Thread Jeff Newmiller
Seems more likely to be related to changes in the options stringr uses when it invokes the regex code? See the different response coming from base R when told to use a different regex engine: grep( "+proj", "syz+project" ) [1] 1 grep( "+proj", "syz+project", perl=TRUE ) Error in grep("+proj

Re: [R] stringr package question

2015-08-13 Thread Jeff Newmiller
"+" is a special character in regular expressions that requires a preceding pattern to apply to. See ?base::regex. You need to escape the special with a backslash to remove the special behavior, and escape the backslash so the R parser will be happy. str_extract("+proj=utm +zone=19 +datum=WGS84

Re: [R] stringr package question

2015-08-13 Thread Mauricio Romero
thanks that makes sense... in the previous version of R it worked for some reason. On Thu, Aug 13, 2015 at 4:33 PM, Sarah Goslee wrote: > Hi, > > The + is a special character in regular expressions. If you want to > match a literal + you need to escape it: > > str_extract("+proj=utm +zone=19

Re: [R] stringr package question

2015-08-13 Thread Sarah Goslee
Hi, The + is a special character in regular expressions. If you want to match a literal + you need to escape it: str_extract("+proj=utm +zone=19 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0", "\\+proj=[a-zA-Z0-9]*") Sarah On Thu, Aug 13, 2015 at 2:55 PM, Mauricio Romero wrote: >

[R] stringr package question

2015-08-13 Thread Mauricio Romero
Hi, I'm running R 3.2.1 and im having an unexpected problem... when I run the follwing code it returns an error library(stringr) str_extract("+proj=utm +zone=19 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0", "+proj=[a-zA-Z0-9]*") But I can't find whats wrong with my code. Thanks