Well, can someone help me with regular expressions??
It's look, I need RE that block textBox empty. I tried everything, but I failed. So I did code something like this:
This code below work very well.

Protected Sub editarNodeButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles editarNodeButton.Click
Dim valorText As String = editarNodeTextBox.Text
Dim espaco As Integer = Asc(" ")
Dim letra As String = Nothing
Dim caracterAnterior As Integer = 0
Dim verificacao As Boolean = True
For i As Integer = 1 To valorText.Length
letra = Mid(valorText, i, 1)
Dim caracterAsc As Integer = Asc(letra)
If caracterAsc.Equals(espaco) And caracterAnterior.Equals(espaco) Then
verificacao = False
End If
caracterAnterior = Asc(letra)
If verificacao And (Not (valorText.Equals("") Or valorText.Equals(" "))) Then
dadosUsuarioTreeView.SelectedNode.Text = editarNodeTextBox.Text
Ocorrencia(1, "Ok")
Ocorrencia(2, "The field is empty or there are double empty.")
End If
Catch ex As Exception
End Try
End Sub

Can someone give me solutions with RE???
Thank You.

if you just want to check if the textbox is empty then do if editarNodeTextBox.Text="" then Return False or if you dont want to allow any spaces at all you can do if editarNodeTextBox.Text.contains(" ") then Return False here is a small Regex example:

Sub Main()
        Dim objAlphaPattern As Regex = New Regex("[a-zA-Z0-9]{1,}$", RegexOptions.IgnoreCase)
        Dim myString As String = "1 "
        Dim myString2 As String = "12"
        If objAlphaPattern.IsMatch(myString) Then
            Console.WriteLine("string1 has matched")
        ElseIf objAlphaPattern.IsMatch(myString2) Then
            Console.WriteLine("string2 has match")
            Console.WriteLine("no match")
        End If
    End Sub

It might help if you tell us what Exactlly you try and using code tags in your posts.

This article has been dead for over six months. Start a new discussion instead.