Skip to content
Extraits de code Groupes Projets
Valider 45ed4104 rédigé par Adrien NUNES's avatar Adrien NUNES
Parcourir les fichiers

Fix

parent 397bc536
Branches aled main
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -11,6 +11,7 @@ const actionRE = new RegExp('<action>', 'gi'); ...@@ -11,6 +11,7 @@ const actionRE = new RegExp('<action>', 'gi');
const MAX_ITERATIONS = 10; const MAX_ITERATIONS = 10;
function fillAllRandomObject(sentence, regularExpr, category){ function fillAllRandomObject(sentence, regularExpr, category){
const matches = sentence.matchAll(regularExpr); const matches = sentence.matchAll(regularExpr);
let objectString = ""; let objectString = "";
let newSentence = sentence; let newSentence = sentence;
...@@ -23,12 +24,11 @@ function fillAllRandomObject(sentence, regularExpr, category){ ...@@ -23,12 +24,11 @@ function fillAllRandomObject(sentence, regularExpr, category){
} }
function shouldBeFilled(sentence) { function shouldBeFilled(sentence) {
return [actorRE, reasonRE, sourceRE, actionRE].some((re) =>{ return [actorRE, reasonRE, sourceRE, actionRE].some((re) =>{
const b = re.test(sentence) const result = re.test(sentence)
if(b){ re.lastIndex = 0;
const matches = sentence.matchAll(re); return result;
for(let match of matches) console.log(match);
}
}); });
} }
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter