The regular expression: (?x-ims:Hello\#\ World\\E) matches as follows: NODE EXPLANATION ---------------------------------------------------------------------- (?x-ims: group, but do not capture (disregarding whitespace and comments) (case-sensitive) (with ^ and $ matching normally) (with . not matching \n): ---------------------------------------------------------------------- Hello 'Hello' ---------------------------------------------------------------------- \# '#' ---------------------------------------------------------------------- \ ' ' ---------------------------------------------------------------------- World 'World' ---------------------------------------------------------------------- \\ '\' ---------------------------------------------------------------------- E 'E' ---------------------------------------------------------------------- ) end of grouping ---------------------------------------------------------------------- ******************** The regular expression: (?x-ims:Hello\#\ World) matches as follows: NODE EXPLANATION ---------------------------------------------------------------------- (?x-ims: group, but do not capture (disregarding whitespace and comments) (case-sensitive) (with ^ and $ matching normally) (with . not matching \n): ---------------------------------------------------------------------- Hello 'Hello' ---------------------------------------------------------------------- \# '#' ---------------------------------------------------------------------- \ ' ' ---------------------------------------------------------------------- World 'World' ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------