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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. regular expression

regular expression

Scheduled Pinned Locked Moved ASP.NET
8 Posts 6 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.
  • S Offline
    S Offline
    sonyrehal
    wrote on last edited by
    #1

    plz give me regular expression to validate numeric value only in regular expression validator thanx

    D S C 3 Replies Last reply
    0
    • S sonyrehal

      plz give me regular expression to validate numeric value only in regular expression validator thanx

      D Offline
      D Offline
      deepak__sharma
      wrote on last edited by
      #2

      this might help function ValidateMobileNo(evt) { var lbl=document.getElementById('lblMobilNoMsg'); lbl.style.display='none'; var iChars = "~`!@#$%^&*()=-[]\\\';,./{}|\":<>?_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; if (evt.value.toString().trim()!="") { for(var i=0;i<evt.value.toString().trim().length;i++) { if(iChars.indexOf(evt.value.toString().trim().charAt(i)) != -1) { lbl.style.display='inline'; lbl.innerHTML="Invalid Value." evt.select(); evt.focus(); return false; } } if ((evt.value.toString().trim().length)<10||(evt.value.toString().trim().length)>15) { lbl.style.display='inline'; lbl.innerHTML="Invalid Mobile No. (should be of 10-15 digit)" evt.select(); evt.focus(); return false; } return true; } }

      1 Reply Last reply
      0
      • S sonyrehal

        plz give me regular expression to validate numeric value only in regular expression validator thanx

        S Offline
        S Offline
        Sundeep Ganiga
        wrote on last edited by
        #3

        ValidationExpression="\d{5}(-\d{4})?" Regards, Sundeep G

        S 1 Reply Last reply
        0
        • S Sundeep Ganiga

          ValidationExpression="\d{5}(-\d{4})?" Regards, Sundeep G

          S Offline
          S Offline
          sonyrehal
          wrote on last edited by
          #4

          thanx..does this expression checks for only numeric values...i mean i just wnat user to input only numeric values for zip code or mobile number generally...no range and length constraints? plz tell me

          S D 2 Replies Last reply
          0
          • S sonyrehal

            thanx..does this expression checks for only numeric values...i mean i just wnat user to input only numeric values for zip code or mobile number generally...no range and length constraints? plz tell me

            S Offline
            S Offline
            Sundeep Ganiga
            wrote on last edited by
            #5

            It is for zipcode with only 5 digits.if u don't need any constraints,then u should go for compare validator and choose datatype as integer. Regards, sundeep G

            1 Reply Last reply
            0
            • S sonyrehal

              thanx..does this expression checks for only numeric values...i mean i just wnat user to input only numeric values for zip code or mobile number generally...no range and length constraints? plz tell me

              D Offline
              D Offline
              dotnetmember
              wrote on last edited by
              #6

              Try this, ^[0-9]+$ Regards Sofia

              1 Reply Last reply
              0
              • S sonyrehal

                plz give me regular expression to validate numeric value only in regular expression validator thanx

                C Offline
                C Offline
                Christian Graus
                wrote on last edited by
                #7

                Did you think that perhaps such a basic need was a good chance to learn something about regex yourself ?

                Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )

                O 1 Reply Last reply
                0
                • C Christian Graus

                  Did you think that perhaps such a basic need was a good chance to learn something about regex yourself ?

                  Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )

                  O Offline
                  O Offline
                  Oakman
                  wrote on last edited by
                  #8

                  Christian Graus wrote:

                  Did you think that perhaps such a basic need was a good chance to learn something about regex yourself ?

                  You're still in here trying, aren't you? I am amazed. Especially at the number of 1 votes you get from the ungrateful twits. I just hope they never find their way to the back room.

                  Jon Smith & Wesson: The original point and click interface

                  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