Add support forregex flags in pattern validation