Joshua Alcott-Griffin
Joshua Alcott-Griffin

Reputation: 107

VB.Net Regex.IsMatch for everything except letters

I am wondering if someone could tell what the Regex sequence is for every type of characters except for Alphabetic characters. My current sequence does not check for some symbols, I have not been able to find a working sequence that covers my needs.

For Each c As Char In courseA
        If Regex.IsMatch(c, "^[0-9 ]+$") Then
            lblMsg.Text += "Position of " + courseA + " contains a  non alphabetic characater."

            errorCount = True

        End If

    Next

Upvotes: 0

Views: 410

Answers (1)

AshKher
AshKher

Reputation: 41

You can try something like ([^a-zA-Z]) to negate all letters.

For negating alphanumeric, you can try [^a-zA-Z0-9]

Upvotes: 3

Related Questions