The second version basically says that the only characters that can precede "MBPS" or "mbps" or "Mbps" (if any) are numbers. Take a look at the results of an extended data block with many features:
> test <- data.frame(Speed=c("2 Mbps", "10 Mbps", "123Mbps", " Mbps", "aMbps", "Mbps")) > grepl("^[0-9]*Mbps$", test[,"Speed"], ignore.case=TRUE) [1] FALSE FALSE TRUE FALSE FALSE TRUE > grepl("[0-9]*Mbps$", test[,"Speed"], ignore.case=TRUE) [1] TRUE TRUE TRUE TRUE TRUE TRUE
"trick" or "gotcha" here is that grepl("[0-9]*Mbps$", ...) really no different from grepl("Mbps$", ...) . This will match a whole string of characters that you probably don't need.
source share