Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2009
    Posts
    32
    Rep Power
    0

    Default Validating url with regular expression??

    HI all,
    I am trying to validate url from following regular expression can you please tell where i am wrong as my eclipse IDE is giving wrong escape sequence. pls help

    String regExp="^(mailto\:|(news|(ht|f)tp(s?))\://)[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)?$";

    Thanks
    Kirti

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    10

    Default

    Every '\' needs to be '\\' in the java regex string (unless the pattern is being read from a file, or something).

  3. #3
    Join Date
    Sep 2009
    Posts
    32
    Rep Power
    0

Similar Threads

  1. regular expression
    By ras_pari in forum Advanced Java
    Replies: 27
    Last Post: 10-07-2009, 12:25 PM
  2. Complex Regular Expression HELP
    By hiklior in forum New To Java
    Replies: 1
    Last Post: 04-30-2008, 01:52 PM
  3. Regular Expression Challange
    By hiklior in forum New To Java
    Replies: 2
    Last Post: 04-24-2008, 05:05 AM
  4. Regular expression with Unions
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-09-2008, 01:03 PM
  5. Regular expression with Intersections
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-09-2008, 01:03 PM

Posting Permissions

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