I have a csv of URLs in one column and a column of strings (words) associated with those URLs.
I want to write a function that goes through each URL and if "/2019/" is present in the URL, assign it to a new variable called "new_url" and if "/2018/" "/2017/" (etc) is present, assign it to a variable called "old_url"
I also want it to go through each of the words in the first column and if "2019" or no year at all is present, assign that to a new variable called "new_word"
example of columns:
hyundai sonata rebate | https://www.edmunds.com/hyundai/sonata/2018/deals
2017 jeep wrangler | https://www.edmunds.com/jeep/wrangler/2017/deals
2019 honda accord | https://www.edmunds.com/honda/accord/2019/deals
I've been trying to work with this https://gist.github.com/gruber/8891611 but am utterly confused and cant get it to work. Any ideas?!