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. Help in Regular Expression

Help in Regular Expression

Scheduled Pinned Locked Moved ASP.NET
helpregex
12 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.
  • N N a v a n e e t h

    Use RequiredFiledValidator along with this RegularExpression validator

    All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

    S Offline
    S Offline
    Sandeep Akhare
    wrote on last edited by
    #3

    Hey Navaneeth the problem here is we can't use asp validator for our application as after firing we are changing the style sheet of controls (in base control) by re rendering its content

    Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

    N 1 Reply Last reply
    0
    • S Sandeep Akhare

      Hi All I need to develop one regular expression that is validating Name field in my application So Name can contain 0-9a-zA-Z. ,./()&'- this type of fields but the problem is if i put only blank spaces then it is returning true please help me it should not take bank place i can't put if else block as i have to give Expression to my validator eg "sandeep01 Akhare&(Peter's)" it ok but " " no should not take

      Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

      R Offline
      R Offline
      r a j u u
      wrote on last edited by
      #4

      use both requiredfieldvalidator and regularexpressionvalidator

      S 1 Reply Last reply
      0
      • R r a j u u

        use both requiredfieldvalidator and regularexpressionvalidator

        S Offline
        S Offline
        Sandeep Akhare
        wrote on last edited by
        #5

        http://www.codeproject.com/script/comments/forums.asp?msg=2300723&forumid=12076#xx2300723xx[^]

        Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

        1 Reply Last reply
        0
        • S Sandeep Akhare

          Hey Navaneeth the problem here is we can't use asp validator for our application as after firing we are changing the style sheet of controls (in base control) by re rendering its content

          Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

          N Offline
          N Offline
          N a v a n e e t h
          wrote on last edited by
          #6

          I guess this can't be done on a single regular expression. Are you allowed to use a custom JS function, Then you can make use of two expressions and validate it.

          All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

          S 1 Reply Last reply
          0
          • N N a v a n e e t h

            I guess this can't be done on a single regular expression. Are you allowed to use a custom JS function, Then you can make use of two expressions and validate it.

            All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

            S Offline
            S Offline
            Sandeep Akhare
            wrote on last edited by
            #7

            Ya that's what i was thinking but i am very poor in Regular expressions so thought lets post it in CP. No we are doing all validations aat server side only

            Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

            N 1 Reply Last reply
            0
            • S Sandeep Akhare

              Ya that's what i was thinking but i am very poor in Regular expressions so thought lets post it in CP. No we are doing all validations aat server side only

              Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

              N Offline
              N Offline
              N a v a n e e t h
              wrote on last edited by
              #8

              playing with bugs ) wrote:

              No we are doing all validations aat server side only

              Use Trim function and check the length. This will trim white spaces in the both end. You can add whitespace trimming in regular expression too. But I think it will remove the spaces in between the words (Sandeep Akhare)

              playing with bugs ) wrote:

              i am very poor in Regular expressions

              It's very interesting. Download RegExBuddy. It's a ultimate tool, and it helped me a lot to learn regular expressions.

              All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

              S 1 Reply Last reply
              0
              • S Sandeep Akhare

                Hi All I need to develop one regular expression that is validating Name field in my application So Name can contain 0-9a-zA-Z. ,./()&'- this type of fields but the problem is if i put only blank spaces then it is returning true please help me it should not take bank place i can't put if else block as i have to give Expression to my validator eg "sandeep01 Akhare&(Peter's)" it ok but " " no should not take

                Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

                P Offline
                P Offline
                Piyush Vardhan Singh
                wrote on last edited by
                #9

                hey man u want to validate any particular alphabate or blank space or both alphabate and blank

                Piyush Vardhan Singh

                S 1 Reply Last reply
                0
                • N N a v a n e e t h

                  playing with bugs ) wrote:

                  No we are doing all validations aat server side only

                  Use Trim function and check the length. This will trim white spaces in the both end. You can add whitespace trimming in regular expression too. But I think it will remove the spaces in between the words (Sandeep Akhare)

                  playing with bugs ) wrote:

                  i am very poor in Regular expressions

                  It's very interesting. Download RegExBuddy. It's a ultimate tool, and it helped me a lot to learn regular expressions.

                  All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

                  S Offline
                  S Offline
                  Sandeep Akhare
                  wrote on last edited by
                  #10

                  N a v a n e e t h wrote:

                  Download RegExBuddy

                  Thanks I will do that ...

                  N a v a n e e t h wrote:

                  Use Trim function and check the length

                  That's what i am doing finally // Check for blank spaces In both first and last Name fields if (String.IsNullOrEmpty(txtFirstName.Text.Trim())) { this.reqFirstName.IsValid = false; } reqFirstName is my validator derived from custom validator this line of code i am writing in my Pages not in validator then question will be why i have used this validator. i think its not proper implementation of validator Any way thanks for your suggestions and providing me RE tool

                  Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

                  1 Reply Last reply
                  0
                  • P Piyush Vardhan Singh

                    hey man u want to validate any particular alphabate or blank space or both alphabate and blank

                    Piyush Vardhan Singh

                    S Offline
                    S Offline
                    Sandeep Akhare
                    wrote on last edited by
                    #11

                    Piyush Vardhan Singh wrote:

                    both alphabate and blank

                    yes PVS it can have 0-9a-zA-Z. ,./()&'- these many alphabets but at same time it should not have just blank space i want regular expression for that

                    Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

                    P 1 Reply Last reply
                    0
                    • S Sandeep Akhare

                      Piyush Vardhan Singh wrote:

                      both alphabate and blank

                      yes PVS it can have 0-9a-zA-Z. ,./()&'- these many alphabets but at same time it should not have just blank space i want regular expression for that

                      Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

                      P Offline
                      P Offline
                      Piyush Vardhan Singh
                      wrote on last edited by
                      #12

                      ^[\w\s,./?;'":`!~@#$%^&*()+=|{}[\]-]{1,500}$ use this for alpha bate,it handle many validation for alphabet in regular expression. first u put this in regular expression validate r and see what happen ofter that arrange this according to ur requirements. and for blank space use required validate r.

                      Piyush Vardhan Singh

                      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