# define a default category
INDEX$UrlCat <- "Not match"
category_name <- c("Category", "Dates", "author page", "Home page")
# create category regex, must be the same length
category_regex <- c("category", "2019", "author","example\.com.\/quot;)
for(i in 1:length(category_name)){
# display a dot to show the progress
# run regex test and update value if it matches
# otherwise leave the previous value
INDEX$UrlCat <- ifelse(grepl(category_regex[i], INDEX$Url, ignore.case = T), category_name[i], INDEX$UrlCat)