You can also use grep
with the ignore.case
argument set to TRUE
> unlist(sapply(B, function(x){
grep(x, ScanName, ignore.case = TRUE, value = TRUE)
}, USE.NAMES = FALSE))
## [1] "hsa-let-7a-2" "hsa-miR-1238"
which gives the same result at
> ScanName[tolower(ScanName) %in% tolower(B)]
## [1] "hsa-let-7a-2" "hsa-miR-1238"