The key insight here is that the only thing that really matters is the last chunk, is it a 4x4? The R function basename(userUrl$path) will get us that last chunk. Then maybe drop the .csv suffix if found. "is4x4" seems like a Boolean function to me, takes a char vector as input, 1) must be 9 char long, 2) must have dash in the middle, 3) each 1/2 is 4 alphanumerics.