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. Regular Expression For Year

Regular Expression For Year

Scheduled Pinned Locked Moved Web Development
csharpregexquestion
3 Posts 3 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.
  • B Offline
    B Offline
    Brendan Vogt
    wrote on last edited by
    #1

    Hi, I am using .NET 1.1 and I am using a regular expression validator control. I have the following: ValidationExpression="[\d]{1,4}$" I need to check that a textbox has anything from 1 to 4 numbers, and numbers only, with no spaces. Will my regular expression cater for it? Year is not reuired, only when there is text in the textbok should it check it. Regards ma se

    L 1 Reply Last reply
    0
    • B Brendan Vogt

      Hi, I am using .NET 1.1 and I am using a regular expression validator control. I have the following: ValidationExpression="[\d]{1,4}$" I need to check that a textbox has anything from 1 to 4 numbers, and numbers only, with no spaces. Will my regular expression cater for it? Year is not reuired, only when there is text in the textbok should it check it. Regards ma se

      L Offline
      L Offline
      Luay Essa
      wrote on last edited by
      #2

      Try this: ^\d{1,4}$

      J 1 Reply Last reply
      0
      • L Luay Essa

        Try this: ^\d{1,4}$

        J Offline
        J Offline
        JimmyRopes
        wrote on last edited by
        #3

        Shouldn't he be checking for either a 1 digit (leading zero implied), 2 digit or a 4 digit input? What does the year entry 402 mean?

        Simply Elegant Designs JimmyRopes Designs
        Think inside the box! ProActive Secure Systems
        I'm on-line therefore I am. JimmyRopes

        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