Conversion from hard coded to regex