From 96df6fa50d3a971089ebcb6d969f5d25a338f5fb Mon Sep 17 00:00:00 2001 From: Shiv Singh Date: Fri, 9 Aug 2024 11:57:26 +0530 Subject: [PATCH] Refactor email extraction logic and improve filtering in findEmail function --- README.md | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1301912..6da9c8c 100644 --- a/README.md +++ b/README.md @@ -1 +1,32 @@ -Extract email address from any raw text data that contains email address +#Extract email address from any raw text data that contains email address + + +##Explanation: + +###Get Input and Options: + +input: Retrieves the text from the input textarea. +separator: Determines the separator based on user selection. +string: The string to filter emails by (if applicable). +groupBy: The number of emails to group together. +addressType: Whether to extract emails or URLs. +filterType: Whether to include or exclude emails based on string. +removeKeywords: An array of keywords to exclude from the results (if UseKeyword is checked). +Set Email Regex: + +Selects the appropriate regular expression based on addressType and RemoveNumeric checkbox. +Extract and Filter: + +rawEmails: Extracts potential emails/URLs using the regex. +uniqueEmails: Uses a Set to get unique emails efficiently. +filteredEmails: Filters emails based on filterType, string, and removeKeywords (if UseKeyword is checked). +Sort (Optional): + +Sorts the filteredEmails alphabetically if the sort checkbox is checked. +Format Output: + +Joins the filteredEmails with the chosen separator and groups them if groupBy is specified. +Display Results: + +Updates the count input with the number of extracted emails. +Sets the output textarea's value to the formatted email string. \ No newline at end of file