Script Idea: Parsing Request Description, paste Email Address in UDF Field

Script Idea: Parsing Request Description, paste Email Address in UDF Field

Hi ManageEngine,

I would like to have a script (best in Deluge) which parses the description of a request and extracts all email address found. I would like to "paste" all these into a specific field (UDF) for further processing.

I worked on a Powershell script like this:

# pattern
$pattern = "([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})"
# get all the matches and store it in an array
$results = ($message | Select-String $pattern -AllMatches).Matches
# iterate over array to act on those items
foreach ($item in ($results)) { Write-Host $item.Value }
# output
Write-Host $results

Which extracts all the Email address.
Will it be possible to have a script in deluge with the same functionality?

The function I would like to implement, is a request with whitelisting of an email address in our Spam Filter. Most of our costumers write emails instead of using the servicedesk. This is why I would like to have a script to fill the custom field in this request. With a business rule, I defined the proper template already.

Thank you in advance,
Chris

                  New to ADSelfService Plus?