// Test debug pour voir l'extraction des instructions const templateTest = `|Titre_Principal{{T0}}{Rédige un titre H1 accrocheur de maximum 10 mots pour {{MC0}}. Style {{personality.style}}}|`; console.log('🔍 TEST EXTRACTION INSTRUCTIONS'); console.log('Template test:', templateTest); // Reproduction de la logique ElementExtraction.js const regex = /\|([^|]+)\|/g; let match; while ((match = regex.exec(templateTest)) !== null) { const fullMatch = match[1]; // Tout entre les |pipes| console.log('FullMatch:', fullMatch); // Extraction des composants (ligne 23-25 ElementExtraction.js) const nameMatch = fullMatch.match(/^([^{]+)/); const variablesMatch = fullMatch.match(/\{\{([^}]+)\}\}/g); const instructionsMatch = fullMatch.match(/\{([^}]+)\}/); console.log('nameMatch:', nameMatch ? nameMatch[1] : null); console.log('variablesMatch:', variablesMatch); console.log('instructionsMatch:', instructionsMatch ? instructionsMatch[1] : null); console.log('\n--- PROBLÈME IDENTIFIÉ ---'); console.log('La regex instructionsMatch cherche {single} mais on a {{double}} ET {single}'); console.log('Il faut une regex qui évite les {{double}} braces'); // Test regex corrigée const instructionsMatchFixed = fullMatch.match(/\{(?!\{)([^}]+)(?