0
ユーザーに電子メールで返信があり、表に記載されている日付を取得する必要があります。表から値を取得する正規表現
私たちのためにそれを行うために、次のコードをした瞬間の場合:
$temp = ($Mail.Body.Text -creplace '(?m)^\s*\r?\n' -split "User name`r`n`tLogon name`r`n`tEnd date`r`n`tNew end date")[1]
(($temp -split "`r`n`t")[3] -split "`r`n")[0]
あなたが見ることができるように、それは非常に長く、非常に多くの-split
に頼っています。日付を取得する簡単な方法はありますか? Select-String
またはRegex
などで
電子メールの表形式は、ユーザーがHTML表の日付を入力する必要があるため、常に同じです。だから私たちはそのテーブルを読むことができる必要があります。下の例では、結果は01/08/2016
になります。電子メールの
例:
Date added below
From: GBR Service Desk
Sent: Wendesday 29 juni 2016 7:00
To: Bond, James (London) GBR
Subject: REMINDER Expiring user:
Importance: High
Dear James
This is a reminder e-mail to inform you that the following Windows user account will expire soon:
User name
Logon name
End date
New end date
Smith, Jobn (Manchester) GBR
jent
01/07/2016
01/08/2016
Because you are registered as the manager of this user, we would like to ask you to verify if this account is still nee
ded after its end date. More text...
Yours sincerely
はあなたの助けをいただき、ありがとうございます。
を!ありがとうございますマティアス:)しかし、時々彼らは "8 augustus"と言うようなものを入力します。その場合、私はそれを持っている必要があります.. – DarkLite1
@ DarkLite1:いくつのフォーマット/人間言語をサポートしますか?それを質問の本文に追加してください。 –
私はこれを解決したものとしてマークします。 – DarkLite1