Hi, I need help for cleaning this:

"[2440810] / www.tinyurl.com/hgaco4fha3"

My desired output is:

"[2440810] / tinyurl".

My attemps:

stringa <- "[2440810] / www.tinyurl.com/hgaco4fha3"

b <- sub('^www.', '', stringa) #wanted  to get rid of "www." part. Until
first dot.

b <- sub('[.].*', '', b) #clean from ".com" until the end.

b #returns ""[2440810] / www"

Thank you.

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to