Refactor codes using REGEXP_CLASS define.