1
VBAの電子メールアドレスからユーザー名を抽出するにはどうすればよいですか?例えば電子メールアドレスでユーザー名を抽出するOutlook VBA正規表現
は - 私の電子メールのIDが "[email protected]" である場合、ユーザ名はこれまで "prateek"
である - 私はこれを書いた -
Set Reg1 = New RegExp
' \s* = invisible spaces
' \d* = match digits
' \w* = match alphanumeric
With Reg1
.Pattern = "\[email protected]\.com"
.Global = True
End With
If Reg1.Test(emailAddress) Then
Set M1 = Reg1.Execute(emailAddress)
For Each M In M1
' M.SubMatches(1) is the (\w*) in the pattern
' use M.SubMatches(2) for the second one if you have two (\w*)
Debug.Print M.SubMatches(1)
Next
End If
しかし、それはのように見えるdoesntのそれはすべてのサブマッチを行く
正規表現は、あなたは、InStr関数は、@ –
@ShaiRadoを探していると、左を使用することができ、ここでは必要ありません:くそー、私は入力した^^ – R3uK