Re: [R] why does regexpr not work with '.'

2008-04-15 Thread jim holtman
In a regular expression, '.' matches any character, which will be the first one. If you want to match a period, you have to escape it: > f="a,[EMAIL PROTECTED]:" #define an arbitrary test string > regexpr('.',f) [1] 1 attr(,"match.length") [1] 1 > regexpr('\\.',f) [1] 4 attr(,"match.length") [1]

[R] why does regexpr not work with '.'

2008-04-15 Thread Jonathan Williams
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 locatio