Przegląd
Otwórz Edytor ładowania danych i dodaj następujący skrypt ładowania do nowej sekcji.
Skrypt ładowania zawiera tekst z korespondencji firmowej, która została wysłana do pracowników pewnej organizacji. Dane zostały już oczyszczone z wszelkich danych osobowych z wyjątkiem nazwy firmy i adresu e-mail, z którego wysłano każdą korespondencję. Treść każdej wiadomości została skondensowana w pojedynczy ciąg znaków. Innymi słowy, wszystkie znaki formatowania i nowej linii zostały usunięte.
Nasze wymagania:
-
Określenie, które wiadomości zawierają ciąg znaków zawierający adres e-mail TestCompanyNameCorrespondence@test.com, wraz z określonym wprowadzeniem do tego adresu, które wskazuje, że był on adresem nadawcy.
-
Chcemy mieć swobodę w wyborze wprowadzeń do identyfikacji, ale także nadal mieć pewne określone ograniczenia. Wprowadzenia Sender i Sent by są uważane za ważne. Aby osiągnąć ten cel, można użyć wzorców wyrażeń regularnych.
-
Wielkość liter w adresach e-mail nie ma znaczenia. W związku z tym nie powinna mieć znaczenia wielkość liter w wyszukiwaniu.
Skrypt ładowania
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 |);
Wyniki
Załaduj dane i otwórz arkusz. Utwórz nową tabelę i dodaj te pola jako wymiary:
Dodaj następującą miarę:
=CountRegExI(MessageBody,'(Sender.*TestCompanyNameCorrespondence@test.com)|(Sent by.*TestCompanyNameCorrespondence@test.com)')
We właściwościach miary ustaw Funkcję sumy na Sum. Konfiguruje to wiersz sum w górnej części tabeli tak, aby zliczał całkowitą liczbę rekordów, które przyczyniają się do zliczania.
Miara zlicza liczbę dopasowań do określonego wzorca wyrażeń regularnych w treści wiadomości. We wzorcu wyrażeń regularnych .* oznacza dowolną liczbę dowolnych znaków z wyjątkiem znaków nowej linii. Wzorzec uwzględnia również różnice we wprowadzeniach do adresów e-mail: zarówno Sender, jak i Sent by są poprawnymi dopasowaniami. Wariant funkcji CountRegExI() zapewnia wyszukiwanie bez uwzględniania wielkości liter.
Tabela wynikowaTotals | - | 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 |
Wśród pięciu wiadomości znajdują się trzy, które pasują do określonego wzorca wyrażeń regularnych. Każda wiadomość zawiera jedno dopasowanie.
InformacjaFunkcja MatchRegEx() jest również przydatna w takich zastosowaniach sprawdzania poprawności.