$modifier = 'i' # or anything else $string =~ /$regex/$modifier;