Fixed reMain regex for better performance.