jorge juan

jorge juan

  • NA
  • 2
  • 769

how to fix null error with regex.match.group.value

Feb 11 2020 4:13 PM
Friend Sub DetectBaseUrl()
Dim domain As String = Nothing
Dim match As String = Regex.Match(GmailClient.Username, ".+@(.+)").Groups(1).Value
If match = String.Empty AndAlso Not New String() {"gmail.com", "googlemail.com", "googlemail.co.uk"}.Contains(match) Then
domain = match
End If
BaseUrl = "http://mail.google.com" + (If((domain IsNot Nothing), ("/a/" + domain), Nothing))
End Sub

Answers (1)