using class constants in stead of raw strings
allow setFlags() to set multiple flags as an array
minor regex optimization to convert br to eol