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. General Programming
  3. Regular Expressions
  4. Regex code to check textfield is working until a 'enter' is given

Regex code to check textfield is working until a 'enter' is given

Scheduled Pinned Locked Moved Regular Expressions
regexhelpquestion
6 Posts 2 Posters 6 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.
  • U Offline
    U Offline
    User 12520493
    wrote on last edited by
    #1

    Hi, we are having troubles whit checking a textfield. What we try to do here is to check if the default text has changed. If that is not the case, then a warning will appear at the end of the form. Everything is working fine until a textfield contains a 'return' (enter) in the text. Even when the default text is gone, the enter will be responsible for the regex-code to fail.. Here the code i have used: ^((?!\bThis contains the default text).)*$ Pleas let me know if you can help me out here What I have tried: several codes... Sorry, i don't have them anymore. We also checked the code with a validator.

    L 2 Replies Last reply
    0
    • U User 12520493

      Hi, we are having troubles whit checking a textfield. What we try to do here is to check if the default text has changed. If that is not the case, then a warning will appear at the end of the form. Everything is working fine until a textfield contains a 'return' (enter) in the text. Even when the default text is gone, the enter will be responsible for the regex-code to fail.. Here the code i have used: ^((?!\bThis contains the default text).)*$ Pleas let me know if you can help me out here What I have tried: several codes... Sorry, i don't have them anymore. We also checked the code with a validator.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      You can use (c#) .Trim() on a string to remove leading / trailing "white space", carriage returns, etc. I tend to do that automatically any time I "save" a string (in a database, for example).

      "(I) am amazed to see myself here rather than there ... now rather than then". ― Blaise Pascal

      1 Reply Last reply
      0
      • U User 12520493

        Hi, we are having troubles whit checking a textfield. What we try to do here is to check if the default text has changed. If that is not the case, then a warning will appear at the end of the form. Everything is working fine until a textfield contains a 'return' (enter) in the text. Even when the default text is gone, the enter will be responsible for the regex-code to fail.. Here the code i have used: ^((?!\bThis contains the default text).)*$ Pleas let me know if you can help me out here What I have tried: several codes... Sorry, i don't have them anymore. We also checked the code with a validator.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        It sounds like you need to add an option your regular expression to work "multiline"? Have you got some code you can show us? Have a look at https://regexr.com/3maco

        Now is it bad enough that you let somebody else kick your butts without you trying to do it to each other? Now if we're all talking about the same man, and I think we are... it appears he's got a rather growing collection of our bikes.

        U 1 Reply Last reply
        0
        • L Lost User

          It sounds like you need to add an option your regular expression to work "multiline"? Have you got some code you can show us? Have a look at https://regexr.com/3maco

          Now is it bad enough that you let somebody else kick your butts without you trying to do it to each other? Now if we're all talking about the same man, and I think we are... it appears he's got a rather growing collection of our bikes.

          U Offline
          U Offline
          User 12520493
          wrote on last edited by
          #4

          The code i have used is in niet question. IT is no longer

          L 1 Reply Last reply
          0
          • U User 12520493

            The code i have used is in niet question. IT is no longer

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            You're welcome! :cool:

            Now is it bad enough that you let somebody else kick your butts without you trying to do it to each other? Now if we're all talking about the same man, and I think we are... it appears he's got a rather growing collection of our bikes.

            U 1 Reply Last reply
            0
            • L Lost User

              You're welcome! :cool:

              Now is it bad enough that you let somebody else kick your butts without you trying to do it to each other? Now if we're all talking about the same man, and I think we are... it appears he's got a rather growing collection of our bikes.

              U Offline
              U Offline
              User 12520493
              wrote on last edited by
              #6

              Thanks a lot!

              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