Easier is
grep("|", stringvector, extended = FALSE)
The only reason for having basic regexps in R is to avoid some of the
escaping needed.
On Tue, 23 Oct 2007, Duncan Murdoch wrote:
> On 23/10/2007 6:34 AM, Daniel Brewer wrote:
>> Hi,
>>
>> I am having a problem searching for the "|" character
On 23/10/2007 6:34 AM, Daniel Brewer wrote:
> Hi,
>
> I am having a problem searching for the "|" character in a string.
>
>> grep("|",stringvector)
> Gives all the strings in a vector but when I try to escape it
>> grep("\|",stringvector)
> It comes up with the error
> Warning messages:
> 1: '\|
Hi,
I am having a problem searching for the "|" character in a string.
> grep("|",stringvector)
Gives all the strings in a vector but when I try to escape it
> grep("\|",stringvector)
It comes up with the error
Warning messages:
1: '\|' is an unrecognized escape in a character string
2: unrecogni
3 matches
Mail list logo