私は、データベースフィールド内のテキストに置き換えられるテキスト文字列から電子メールアドレスを抽出する次のコードを持っています。Visual Basicプライバシーのために電子メールアドレスの特定の文字を置換してください
文字列には1つのメールアドレスが含まれます。 - 完全な電子メールアドレス
- [email protected]を次のように私はすでにメールアドレスを分割していますすべての文字を**************(フル電子メール)または個々の部分に置き換えることができるコードを含めました。
私が必要なことをやったときに再びテキストを組み合わせるのは簡単です。
私が取得しようとしています結果:
テ** @ ********座
は最初の2つの文字を除いて、最初の部分ですべてを隠れるくらいとして考えていました最後の部分、最後の2文字を除くすべて。
Dim newText As string = "" Dim senText As String = "This is a long string that we will try [email protected] to extract the email address from, it might exist anywhere in this string." Dim emailRegEx As New Regex("(\S+)@([^\.\s]+)(?:\.([^\.\s]+))+") Dim m As Match = emailRegEx.Match(senText) If m.Success Then newText = m.ToString End If Dim mystr As String = newText Dim cut_at As String = "@" Dim x As Integer = InStr(mystr, cut_at) Dim string_before As String = mystr.Substring(0, x - 1) Dim string_after As String = mystr.Substring(x + cut_at.Length - 1) Dim myString As String = New String("*"c, newText.Length) Dim PrivateMail As String = "" response.write(newText) response.write(myString) response.write(string_before) response.write(string_after)
ご協力いただければ幸いです。
はそんなに@enigmativityありがとう、あなたは伝説の先生です! – Deedz