[R] regex for "[2440810] / www.tinyurl.com/hgaco4fha3"

Omar André Gonzáles Díaz oma.gonzales at gmail.com
Wed Feb 21 06:19:52 CET 2018


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]]



More information about the R-help mailing list