fixed regex detection bug