Skip to content

Instantly share code, notes, and snippets.

@kiwec
Last active March 1, 2021 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kiwec/6a09e5df37006b150ee8b79f8a55d17e to your computer and use it in GitHub Desktop.
Save kiwec/6a09e5df37006b150ee8b79f8a55d17e to your computer and use it in GitHub Desktop.
// Code de QUALITÉ (issou)
// picunroll avant de lancer le script bien entendu
var arr = [];
$('.conteneur-message').each(function(){
var name = $(this).find('.text-user').text().trim();
// HACK nettoyage du message
$(this).find('a').remove();
$(this).find('blockquote').remove();
$(this).find('.signature-msg').remove();
$(this).find('.info-edition-msg').remove();
var text = $(this).find('.bloc-contenu').text();
// x chiffres + optionellement un séparateur + 3 chiffres ou +
// Tout montant > 100$ ok
var re = /(\d+)\D?(\d{3,})/g;
var matches = re.exec(text);
if(!matches) return;
var val = parseInt((matches[1] + "" + matches[2]), 10);
if(!val || isNaN(val)) return;
if(arr[val])
arr[val].push(name);
else
arr[val] = [name];
});
for(var i in arr) {
if(!arr.hasOwnProperty(i)) continue;
document.getElementById('message_topic').value += '* ' + i + '$ : ' + arr[i].join(', ') + '\n';
}
@kiwec
Copy link
Author

kiwec commented Jul 14, 2017

MaJ : '2' + 3 carac changé en regex de 4 chiffres

TO THE GANGE

@kiwec
Copy link
Author

kiwec commented Jul 31, 2017

MaJ : suppression des citations, liens et signatures avant recherche

@kiwec
Copy link
Author

kiwec commented Dec 13, 2017

MaJ : plusieurs nombres par pseudo + tous nombres au dessus de 10 gérés, y compris les "10 000" au lieu de "10000".

@kiwec
Copy link
Author

kiwec commented Jan 17, 2018

MaJ : meilleur regex

  // (x chiffres) + (optionellement un séparateur) + (3 chiffres ou +)
  // Tout montant > 100$ ok

@kiwec
Copy link
Author

kiwec commented Mar 1, 2021

MaJ : suppression des blocs "message edit le..." qui trigger le regex avec "2021"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment