Dear R Helpers,

I am running R 2.6.2 on a Windows XP machine.

I am trying to use regexpr to locate full stops in strings, but, without
success.

Here an example:-

f="a,[EMAIL PROTECTED]:" #define an arbitrary test string
regexpr(',',f) #find the occurrences of ',' in f - should be one at location
2
               # and this is what regexpr finds
#[1] 2
#attr(,"match.length")
#[1] 1

regexpr('@',f) #find occurrences of '@' in f - should be one at location 6
               # and this is what regexpr finds
#[1] 6
#attr(,"match.length")
#[1] 1

regexpr('.',f) #find the occurrences '.' in f - should be one at location 4
                   # but regexpr gives 1 at location 1
#[1] 1
#attr(,"match.length")
#[1] 1

Sorry if I am missing something obvious. I'd be very grateful if someone
would
please show me how to use regexpr to locate '.' in my string!

Thanks,

Jonathan Williams

______________________________________________
R-help@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.

Reply via email to