Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. RegExp

RegExp

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netcomhelpquestion
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    fmardani
    wrote on last edited by
    #1

    Hi, I am using a RegularExpression validator control in asp.net 2.0 Found an expression for validating uk postcodes (http://regexlib.com/REDetails.aspx?regexp\_id=1064). Not sure why the validator control on the form does not function correctly because the error messsage of the validator shows up whether or not the postcode is valid. There is a textbox called txtpostcode the controltovalidate property of the validator is set to txtpostcode. The errormessage is also set. I believe I have set up the validator correctly on the page and assigned it to the correct textbox on the webform. Any thoughts please? Thanks

    S G 2 Replies Last reply
    0
    • F fmardani

      Hi, I am using a RegularExpression validator control in asp.net 2.0 Found an expression for validating uk postcodes (http://regexlib.com/REDetails.aspx?regexp\_id=1064). Not sure why the validator control on the form does not function correctly because the error messsage of the validator shows up whether or not the postcode is valid. There is a textbox called txtpostcode the controltovalidate property of the validator is set to txtpostcode. The errormessage is also set. I believe I have set up the validator correctly on the page and assigned it to the correct textbox on the webform. Any thoughts please? Thanks

      S Offline
      S Offline
      Suseel kumar P
      wrote on last edited by
      #2

      Make sure that You are using Internet Explorer. Other browsers usually won't support .NET Validation Controls. Suseel Kumar

      F 1 Reply Last reply
      0
      • F fmardani

        Hi, I am using a RegularExpression validator control in asp.net 2.0 Found an expression for validating uk postcodes (http://regexlib.com/REDetails.aspx?regexp\_id=1064). Not sure why the validator control on the form does not function correctly because the error messsage of the validator shows up whether or not the postcode is valid. There is a textbox called txtpostcode the controltovalidate property of the validator is set to txtpostcode. The errormessage is also set. I believe I have set up the validator correctly on the page and assigned it to the correct textbox on the webform. Any thoughts please? Thanks

        G Offline
        G Offline
        Guffa
        wrote on last edited by
        #3

        The RegularExressionValidator uses regular expressions without ^ and $ marking the start and end of the string. Try to remove those from the pattern. --- b { font-weight: normal; }

        F 1 Reply Last reply
        0
        • S Suseel kumar P

          Make sure that You are using Internet Explorer. Other browsers usually won't support .NET Validation Controls. Suseel Kumar

          F Offline
          F Offline
          fmardani
          wrote on last edited by
          #4

          I am already using IE Thanks

          1 Reply Last reply
          0
          • G Guffa

            The RegularExressionValidator uses regular expressions without ^ and $ marking the start and end of the string. Try to remove those from the pattern. --- b { font-weight: normal; }

            F Offline
            F Offline
            fmardani
            wrote on last edited by
            #5

            Hi, I tried it. This does not make a difference.Thanks

            G 1 Reply Last reply
            0
            • F fmardani

              Hi, I tried it. This does not make a difference.Thanks

              G Offline
              G Offline
              Guffa
              wrote on last edited by
              #6

              Start with a simple part of the regular expression then, and add complexity once you got it to work. --- b { font-weight: normal; }

              L 1 Reply Last reply
              0
              • G Guffa

                Start with a simple part of the regular expression then, and add complexity once you got it to work. --- b { font-weight: normal; }

                L Offline
                L Offline
                lehya
                wrote on last edited by
                #7

                [a-zA-Z]{2}\d{1,2}\s\d{1}[a-zA-Z]{2}$ This will work for formats like SR4 2KL and SR2 74KL etc...Tell me if it works r not -lehya

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups