I try to split a string using strsplit(str, '[,-\\+]')
, which means any ',', '-' or '+'
could be a delimiter. However, I found this pattern seems to also match numbers and capital letters.
Try
grep('[,-\\]', 'X'), returns 1
grep('[,-\\]', '46'), returns 1
grep('[,-\\]', '-'), returns 1
grep('[,-\\]', ','), returns 1
It seems to be '[,-\\]'
matching all numbers, capital letters, ','
and '-'
.
I just don't get why this is the case.
Thank you for any input