The regular expression: (?-imsx:INC[0-9]\{7\}) matches as follows: NODE EXPLANATION ---------------------------------------------------------------------- (?-imsx: group, but do not capture (case-sensitive) (with ^ and $ matching normally) (with . not matching \n) (matching whitespace and # normally): ---------------------------------------------------------------------- INC 'INC' ---------------------------------------------------------------------- [0-9] any character of: '0' to '9' ---------------------------------------------------------------------- \{ '{' ---------------------------------------------------------------------- 7 '7' ---------------------------------------------------------------------- \} '}' ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------