regex performance enhancement