4 Replies Latest reply: Nov 19, 2012 1:02 AM by Kayaman RSS

    validation

    user575089
      What is the pattern to validate 1234567890H ?

      Rule: 10 digits followed by a character.

      How do i validate without regex ?
        • 1. Re: validation
          Kayaman
          user575089 wrote:
          What is the pattern to validate 1234567890H ?

          Rule: 10 digits followed by a character.
          Something along the lines of: \d{10}\w
          How do i validate without regex ?
          Use the Character.isDigit() and Character.isLetter() methods.
          • 2. Re: validation
            EJP
            What is the pattern to validate 1234567890H ?
            The pattern to validate 1234567890H is "1234567890H".
            Rule: 10 digits followed by a character.
            The pattern to match that rule is "[0-9]{10}[A-Za-z]", possibly omitting the a-z part if it can't be lowercase.
            How do i validate without regex ?
            What's the question here? You've asked for a pattern when you didn't need one; you asked for another pattern when you did need one; and now you're asking for not a pattern when you do need one.
            • 3. Re: validation
              user575089
              EJP wrote:
              What is the pattern to validate 1234567890H ?
              The pattern to validate 1234567890H is "1234567890H".
              Rule: 10 digits followed by a character.
              The pattern to match that rule is "[0-9]{10}[A-Za-z]", possibly omitting the a-z part if it can't be lowercase.
              What does {10} do ?
              • 4. Re: validation
                Kayaman
                user575089 wrote:
                What does {10} do ?
                Here's the documentation http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html