Results 1 to 6 of 6
Like Tree1Likes
  • 1 Post By kjkrum

Thread: validate a String in java Regular Expression

  1. #1
    khalidhabib is offline Member
    Join Date
    Oct 2013
    Posts
    1
    Rep Power
    0

    Default validate a String in java Regular Expression

    Dear Friends Kindly help me to validate a String in following way

    a. If first character is an alphabet, input should be Alpha Numeric 24 characters
    b. If first character is a digit, input should be minimum 15 and maximum 16 Numeric characters

    I need a regular Expression or Java program example

    Thanks in advance

  2. #2
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default Re: validate a String in java Regular Expression

    See the answer in your crosspost: validate a String in java Regular Expression
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  3. #3
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: validate a String in java Regular Expression

    I found this site very helpful when I was learning how to write regexes: Regular-Expressions.info - Regex Tutorial, Examples and Reference - Regexp Patterns
    gimbal2 likes this.
    Get in the habit of using standard Java naming conventions!

  4. #4
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,741
    Rep Power
    5

    Default Re: validate a String in java Regular Expression

    Nice site. I like how data is represented with colored blocks, really readable. I'm going to steal that.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,184
    Rep Power
    19

    Default Re: validate a String in java Regular Expression

    Quote Originally Posted by gimbal2 View Post
    I like how data is represented with colored blocks, really readable.
    Inasmuch as regex is ever really readable ...

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  6. #6
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,371
    Blog Entries
    7
    Rep Power
    20

    Default Re: validate a String in java Regular Expression

    Quote Originally Posted by DarrylBurke View Post
    Inasmuch as regex is ever really readable ...
    ++

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Java Help Regular Expression
    By geforce in forum New To Java
    Replies: 13
    Last Post: 01-28-2012, 08:29 AM
  2. Test if string *could* match regular expression
    By kjkrum in forum Advanced Java
    Replies: 11
    Last Post: 07-12-2011, 10:01 AM
  3. Replies: 1
    Last Post: 04-04-2011, 12:51 PM
  4. Java Regular Expression help
    By royalibrahim in forum Advanced Java
    Replies: 11
    Last Post: 11-12-2009, 01:27 AM
  5. Replies: 2
    Last Post: 11-11-2009, 05:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •