Displaying 3 results from an estimated 3 matches for "32s5970".
2017 Aug 27
6
regex - optional part isn't considered in replacement with gsub
Hello, I need some help with regex.
I have this to sentences. I need to extract both "49MU6300" and "LE32S5970"
and put them in a new colum "SKU".
A) SMART TV UHD 49'' CURVO 49MU6300
B) SMART TV HD 32'' LE32S5970
DataFrame for testing:
ecommerce <- data.frame(a = c(1,2), producto = c("SMART TV UHD 49'' CURVO
49MU6300",
"...
2017 Aug 28
0
regex - optional part isn't considered in replacement with gsub
...mean by
> >>> "capture" (what vaue do you wish to return?) -- as the "obvious"
> >>> answer is probably not sufficient:
> >>>
> >>> ## using your example -- thankyou
> >>>
> >>>> gsub(".*(49MU6300|LE32S5970).*","\\1",ecommerce[[2]])
> >>> [1] "49MU6300" "LE32S5970"
> >>>
> >>>
> >>> Cheers,
> >>> Bert
> >>> Bert Gunter
> >>>
> >>> "The trouble with having an open min...
2017 Aug 27
0
regex - optional part isn't considered in replacement with gsub
...h to "capture" -- including exactly what you mean by
>> "capture" (what vaue do you wish to return?) -- as the "obvious"
>> answer is probably not sufficient:
>>
>> ## using your example -- thankyou
>>
>>> gsub(".*(49MU6300|LE32S5970).*","\\1",ecommerce[[2]])
>> [1] "49MU6300" "LE32S5970"
>>
>>
>> Cheers,
>> Bert
>> Bert Gunter
>>
>> "The trouble with having an open mind is that people keep coming along
>> and sticking things into it....