how can I remove all words that start with "@" from a string?
For example, "@AgnezMo On @AirAsia Airbus A320-216 Fleet with @NinetologyMY Livery -- 9M-AHG cc: @AgnesMonicaEnt @agnezone http://t.co/hfXwUQq2Oq"
I would like to have the string to be "On Airbus A320-216 Fleet with Livery -- 9M-AHG cc: http://t.co/hfXwUQq2Oq"
Try this where s
is the input:
gsub("@\\w+ *", "", s)
giving:
"On Airbus A320-216 Fleet with Livery -- 9M-AHG cc: http://t.co/hfXwUQq2Oq"
Hi you can do like this :
xx <- "@AgnezMo On @AirAsia Airbus A320-216 Fleet with @NinetologyMY Livery -- 9M-AHG cc: @AgnesMonicaEnt @agnezone http://t.co/hfXwUQq2Oq"
gsub("@([a-zA-Z0-9]|[_])*", "", xx)
## [1] " On Airbus A320-216 Fleet with Livery -- 9M-AHG cc: http://t.co/hfXwUQq2Oq"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With