Vue d'ensemble
Ouvrez l'Éditeur de chargement de données et ajoutez le script de chargement suivant à une nouvelle section.
Le script de chargement contient le texte d'un certain nombre de courriers professionnels qui ont été envoyés aux employés d'une entreprise. Les données ont déjà été nettoyées de toute information personnelle identifiable (PII), à l'exception du nom d'entreprise et de l'adresse e-mail qui a envoyé chaque courrier. Le corps de chaque message a été réduit à une seule chaîne continue. En d'autres termes, tous les caractères de formatage et de retour à la ligne ont été retirés.
Nos besoins :
-
Identifier les messages qui contiennent une chaîne comprenant l'adresse e-mail TestCompanyNameCorrespondence@test.com, ainsi qu'une introduction spécifique à cette adresse indiquant qu'il s'agit de l'expéditeur.
-
Nous souhaitons disposer d'une certaine souplesse dans le choix des introductions à identifier, mais aussi de certaines restrictions précises. Les introductions Sender et Sent by sont toutes les deux considérées comme valides. Pour atteindre cet objectif, il est possible d'utiliser des modèles de regex.
-
La sensibilité à la casse des adresses e-mail n'entre pas en ligne de compte. La recherche ne doit donc pas être sensible à la casse.
Script de chargement
Correspondences:
Load * Inline [
ID|MessageBody
1|Sent by-- TestCompanyNameCorrespondence@test.com Good morning TestCompanyName team! I hope you are all well. I am just reaching out about the fabulous benefits package we launched just year. Our goal is to take a poll of what you all think. Can you please rate the new options from 1-10 in a response to this email, by this Tuesday? Thank you!
2|Sender: TestCompanyNameIT@test.com Did you know you can access our IT portal anytime, from any of your company devices? It's true! Reach out to your team lead to learn more.
3|Sender: TESTCOMPANYNAMECORRESPONDENCE@test.COM URGENT: This is a message to inform employees of an ongoing issue with our local branch. The branch will be closed until further notice. Thank you
4|Sender: TestCompanyNameVolunteering@test.com Dear team! We are looking for volunteers to help with this year's charity event! We need 40 volunteers to help with the event. If you are interested, please send an email to your direct supervisor. Thanks, TestCompanyName team members, for helping make the world a better place!
5|Sender is TestCompanyNameCorrespondence@test.com Hi folks, it's time to announce the annual TestCompanyName staff party! The party will be taking place at the office this year. Please make sure to RSVP, and we hope to see you there! Sincerely, the TestCompanyName management team
] (delimiter is |);
Résultats
Chargez les données et ouvrez une feuille. Créez une table et ajoutez ces champs comme dimensions :
Ajoutez la mesure suivante :
=CountRegExI(MessageBody,'(Sender.*TestCompanyNameCorrespondence@test.com)|(Sent by.*TestCompanyNameCorrespondence@test.com)')
Dans les propriétés de la mesure, définissez la fonction Totaux sur Sum. Cela configure la ligne des totaux en haut du tableau de sorte à compter le nombre total d'enregistrements qui contribuent au comptage.
La mesure compte le nombre de correspondances au modèle de regex spécifié dans le contenu du message. Dans le modèle de regex, .* indique n'importe quel nombre de caractères, à l'exception des caractères de retour à la ligne. Le modèle tient également compte des variations dans la manière dont l'adresse e-mail est introduite : les introductions Sender et Sent by sont toutes les deux valides. La variante CountRegExI() de la fonction permet d'effectuer des recherches sans tenir compte de la casse.
Tableau de résultatsTotals | - | 3 |
1 | Sent by-- TestCompanyNameCorrespondence@test.com Good morning TestCompanyName team! I hope you are all well. I am just reaching out about the fabulous benefits package we launched just year. Our goal is to take a poll of what you all think. Can you please rate the new options from 1-10 in a response to this email, by this Tuesday? Thank you! | 1 |
2 | Sender: TestCompanyNameIT@test.com Did you know you can access our IT portal anytime, from any of your company devices? It's true! Reach out to your team lead to learn more. | 0 |
3 | Sender: TESTCOMPANYNAMECORRESPONDENCE@TEST.COM URGENT: This is a message to inform employees of an ongoing issue with our local branch. The branch will be closed until further notice. Thank you | 1 |
4 | Sender: TestCompanyNameVolunteering@test.com Dear team! We are looking for volunteers to help with this year's charity event! We need 40 volunteers to help with the event. If you are interested, please send an email to your direct supervisor. Thanks, TestCompanyName team members, for helping make the world a better place! | 0 |
5 | Sender is TestCompanyNameCorrespondence@test.com Hi folks, it's time to announce the annual TestCompanyName staff party! The party will be taking place at the office this year. Please make sure to RSVP, and we hope to see you there! Sincerely, the TestCompanyName management team | 1 |
Sur les cinq messages, trois correspondent au modèle de regex spécifié. Chaque message contient une correspondance.
Note InformationsLa fonction MatchRegEx() est également utile pour ces types de cas d'utilisation de validation.