Add support for regex flags in pattern validation