This discussion is archived
4 Replies Latest reply: Nov 18, 2012 10:56 PM by user575089 RSS

validation

user575089 Newbie
Currently Being Moderated
What is the pattern to validate 1234567890H ?

Rule: 10 digits followed by a character.

How do i validate without regex ?
  • 1. Re: validation
    Kayaman Guru
    Currently Being Moderated
    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 Guru
    Currently Being Moderated
    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 Newbie
    Currently Being Moderated
    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 Guru
    Currently Being Moderated
    user575089 wrote:
    What does {10} do ?
    Here's the documentation http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points