On Jul 31, 2014, at 3:17 AM, Uwe Ligges wrote:
>
>
> On 31.07.2014 04:46, carol white wrote:
>> There are some level of variation either chars followed by numbers or chars,
>> numbers, chars
>>
>>
>> Perhaps, I should use gsub as you suggested all and if the string is
>> composed of chars
On 31.07.2014 04:46, carol white wrote:
There are some level of variation either chars followed by numbers or chars,
numbers, chars
Perhaps, I should use gsub as you suggested all and if the string is composed
of chars followed by numbers, it will return the 3rd part empty?
Please read a
If you have some variations of the order of numbers followed by chars,
library(stringr)
v1 <- c("absdfds0213451ab", "123abcs4145")
pattern=c("[A-Za-z]+", "\\d+")
do.call(`Map`,c(c,lapply(pattern, function(.pat) str_extract_all(v1, .pat
#[[1]]
#[1] "absdfds" "ab" "0213451"
#[[2]]
#[1] "
There are some level of variation either chars followed by numbers or chars,
numbers, chars
Perhaps, I should use gsub as you suggested all and if the string is composed
of chars followed by numbers, it will return the 3rd part empty?
Regards,
Carol
On Wednesday, July 30, 2014 10:52 PM, Mar
On 30.07.2014 22:13, carol white wrote:
Hi,
If I have a string of consecutive chars followed by consecutive numbers and then chars,
like "absdfds0213451ab", how to separate the consecutive chars from consecutive
numbers?
grep doesn't seem to be helpful
grep("[a-z]","absdfds0213451ab", ignor
On Jul 30, 2014, at 3:13 PM, carol white wrote:
> Hi,
> If I have a string of consecutive chars followed by consecutive numbers and
> then chars, like "absdfds0213451ab", how to separate the consecutive chars
> from consecutive numbers?
>
> grep doesn't seem to be helpful
>
> grep("[a-z]","ab
Hello,
Maybe ?gregexpr and ?regmatches. SOmething like the following.
m1 <- gregexpr("[a-z]+","absdfds0213451ab")
regmatches("absdfds0213451ab", m1)
m2 <- gregexpr("[0-9]+","absdfds0213451ab")
regmatches("absdfds0213451ab", m2)
Hope this helps,
Rui Barradas
Em 30-07-2014 21:13, carol white
Hi,
If I have a string of consecutive chars followed by consecutive numbers and
then chars, like "absdfds0213451ab", how to separate the consecutive chars from
consecutive numbers?
grep doesn't seem to be helpful
grep("[a-z]","absdfds0213451ab", ignore.case=T)
[1] 1
grep("[0-9]","absdfds0213
8 matches
Mail list logo