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. Newline in regular expression validation...

Newline in regular expression validation...

Scheduled Pinned Locked Moved ASP.NET
questioncomregex
11 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.
  • P phimix

    I have a fancy asp:RegularExpressionValidator with this ValidationExpression: "^([0-9a-zA-Z _+-.*()&#%':!])+$" How do I change it so newlines are allowed in the associated multiline textbox? I have tried adding "\n" here and there, but it still doesn't work :( Guess newline is called something else or that I'm adding it in a wrong place. Thanks.

    phi Geek Load - Free Geek Stuff for Everybody :omg:

    D Offline
    D Offline
    Deepak the Cool
    wrote on last edited by
    #2

    hi check following url. tht may b helps to u. [](http://msdn2.microsoft.com/en-us/library/ms972966.aspx#regexnet_topic9)[http://msdn2.microsoft.com/en-us/library/ms972966.aspx#regexnet_topic9](http://msdn2.microsoft.com/en-us/library/ms972966.aspx#regexnet_topic9)[[^](http://msdn2.microsoft.com/en-us/library/ms972966.aspx#regexnet_topic9 "New Window")] :)

    Deepak Smile a Lots,Its Costs Nothing

    P 1 Reply Last reply
    0
    • D Deepak the Cool

      hi check following url. tht may b helps to u. [](http://msdn2.microsoft.com/en-us/library/ms972966.aspx#regexnet_topic9)[http://msdn2.microsoft.com/en-us/library/ms972966.aspx#regexnet_topic9](http://msdn2.microsoft.com/en-us/library/ms972966.aspx#regexnet_topic9)[[^](http://msdn2.microsoft.com/en-us/library/ms972966.aspx#regexnet_topic9 "New Window")] :)

      Deepak Smile a Lots,Its Costs Nothing

      P Offline
      P Offline
      phimix
      wrote on last edited by
      #3

      Thanks, but I have already found that page myself. That's where I learned newline was to be written as "\n".

      phi Geek Load - Free Geek Stuff for Everybody :omg:

      1 Reply Last reply
      0
      • P phimix

        I have a fancy asp:RegularExpressionValidator with this ValidationExpression: "^([0-9a-zA-Z _+-.*()&#%':!])+$" How do I change it so newlines are allowed in the associated multiline textbox? I have tried adding "\n" here and there, but it still doesn't work :( Guess newline is called something else or that I'm adding it in a wrong place. Thanks.

        phi Geek Load - Free Geek Stuff for Everybody :omg:

        W Offline
        W Offline
        Walter_H
        wrote on last edited by
        #4

        have you tried to remove the "^" and "$" characters?these specify the beginning("^") and the end("$") of a line.so it makes no sense if "\n" is placed between these two. walter

        P 1 Reply Last reply
        0
        • W Walter_H

          have you tried to remove the "^" and "$" characters?these specify the beginning("^") and the end("$") of a line.so it makes no sense if "\n" is placed between these two. walter

          P Offline
          P Offline
          phimix
          wrote on last edited by
          #5

          I have tried the following (all unsuccessful): ^([0-9a-zA-Z _+-.*()&#%':!])+$\n ^([0-9a-zA-Z _+-.*()&#%':!])\n+$ ([0-9a-zA-Z _+-.*()&#%':!])+\n ([0-9a-zA-Z _+-.*()&#%':!])\n+ ^([0-9a-zA-Z _+-.*()&#%':!])\r\n+$ ^([0-9a-zA-Z _+-.*()&#%':!])+\r\n$ ([0-9a-zA-Z _+-.*()&#%':!])+\r\n ([0-9a-zA-Z _+-.*()&#%':!])\r\n+

          phi Geek Load - Free Geek Stuff for Everybody :omg:

          W 1 Reply Last reply
          0
          • P phimix

            I have tried the following (all unsuccessful): ^([0-9a-zA-Z _+-.*()&#%':!])+$\n ^([0-9a-zA-Z _+-.*()&#%':!])\n+$ ([0-9a-zA-Z _+-.*()&#%':!])+\n ([0-9a-zA-Z _+-.*()&#%':!])\n+ ^([0-9a-zA-Z _+-.*()&#%':!])\r\n+$ ^([0-9a-zA-Z _+-.*()&#%':!])+\r\n$ ([0-9a-zA-Z _+-.*()&#%':!])+\r\n ([0-9a-zA-Z _+-.*()&#%':!])\r\n+

            phi Geek Load - Free Geek Stuff for Everybody :omg:

            W Offline
            W Offline
            Walter_H
            wrote on last edited by
            #6

            what exactly do you want to validate? give me an example of the validated text and the rules you want to apply walter

            P 1 Reply Last reply
            0
            • W Walter_H

              what exactly do you want to validate? give me an example of the validated text and the rules you want to apply walter

              P Offline
              P Offline
              phimix
              wrote on last edited by
              #7

              I want to validate something like this: -------- BBC Health, Article #6180753: Important!! Vegetarians were more likely to be female, to be of higher occupational social class and to have higher academic or vocational qualifications than non-vegetarians. However, these differences were not reflected in their annual income, which was similar to that of non-vegetarians. Lead researcher Catharine Gale said: "The finding that children with greater intelligence are more likely to report being vegetarian as adults, together with the evidence on the potential benefits of a vegetarian diet on heart health, may help to explain why higher IQ in childhood or adolescence is linked with a reduced risk of coronary heart disease in adult life." --------

              phi Geek Load - Free Geek Stuff for Everybody :omg:

              W 1 Reply Last reply
              0
              • P phimix

                I want to validate something like this: -------- BBC Health, Article #6180753: Important!! Vegetarians were more likely to be female, to be of higher occupational social class and to have higher academic or vocational qualifications than non-vegetarians. However, these differences were not reflected in their annual income, which was similar to that of non-vegetarians. Lead researcher Catharine Gale said: "The finding that children with greater intelligence are more likely to report being vegetarian as adults, together with the evidence on the potential benefits of a vegetarian diet on heart health, may help to explain why higher IQ in childhood or adolescence is linked with a reduced risk of coronary heart disease in adult life." --------

                phi Geek Load - Free Geek Stuff for Everybody :omg:

                W Offline
                W Offline
                Walter_H
                wrote on last edited by
                #8

                try this one: ([0-9a-zA-Z _\+-\.\*\(\)&#%':!\n"])+ hope that helps walter

                P 1 Reply Last reply
                0
                • W Walter_H

                  try this one: ([0-9a-zA-Z _\+-\.\*\(\)&#%':!\n"])+ hope that helps walter

                  P Offline
                  P Offline
                  phimix
                  wrote on last edited by
                  #9

                  It helped half of the way :) It now passes client side, but fails server side. this.IsValid returns false server side...

                  phi Geek Load - Free Geek Stuff for Everybody :omg:

                  W 1 Reply Last reply
                  0
                  • P phimix

                    It helped half of the way :) It now passes client side, but fails server side. this.IsValid returns false server side...

                    phi Geek Load - Free Geek Stuff for Everybody :omg:

                    W Offline
                    W Offline
                    Walter_H
                    wrote on last edited by
                    #10

                    well...;) there's probably a problem with the view-state in your site, i don't know. maybe you'll find these links helpful: RegExLib[^] and RegEx-Coach[^] for testing your regular expressions. good luck walter

                    P 1 Reply Last reply
                    0
                    • W Walter_H

                      well...;) there's probably a problem with the view-state in your site, i don't know. maybe you'll find these links helpful: RegExLib[^] and RegEx-Coach[^] for testing your regular expressions. good luck walter

                      P Offline
                      P Offline
                      phimix
                      wrote on last edited by
                      #11

                      Great links, thanks. Now it works perfectly in Firefox, but it fails clientside in bloody Explorer... I'm using: ([0-9a-zA-Z _\+-\.\*\(\)&#%':!\n"])+ RegEx-Coach say everything is fine about the expression.

                      phi Geek Load - Free Geek Stuff for Everybody :omg:

                      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