The regular expression: (?-imsx:[A-Z]*.pdf) 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): ---------------------------------------------------------------------- [A-Z]* any character of: 'A' to 'Z' (0 or more times (matching the most amount possible)) ---------------------------------------------------------------------- . any character except \n ---------------------------------------------------------------------- pdf 'pdf' ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------