Fix regex generation