Results 1 to 9 of 9

Thread: [RESOLVED] VB.NET regex validation differs from Javascript

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2008
    Location
    Philippines
    Posts
    117

    Resolved [RESOLVED] VB.NET regex validation differs from Javascript

    Given the following codes and my input is new@[email protected]
    this one returns false
    VB.NET Code:
    1. <asp:RegularExpressionValidator
    2.      ID="REV1"
    3.      runat="server"
    4.      Display="Static"
    5.      ErrorMessage="Error."
    6.      ControlToValidate="txtEmailAdd"
    7.      ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" />

    but this one returns true
    VB.NET Code:
    1. Dim myMatch As Match = System.Text.RegularExpressions.Regex.Match(txtEmailAdd.Text, "\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*")
    2. If Not myMatch.Success Then
    3.     Result.Text = "Error."
    4.     Exit Sub
    5. End If
    can anyone tell me what's wrong? Thanks in advance.
    Last edited by savior14; Apr 27th, 2010 at 05:09 AM.
    im a newbie in vb.net field so please always bear with me

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width