title: How can I validate a URL in android
body: <p>How can I validate URL in android... I am trying to use regex but it is always returning false even if the url is correct</p>
  
  <p>Code used:</p>
  
  <pre><code>private boolean checkEmail(String email) {
          return URL.matcher(email).matches();
  }
      public final Pattern URL = Pattern.compile(
                "/((([A-Za-z]{3,9}:(?:\\/\\/)?)(?:[-;:&amp;=\\+\\$,\\w]+@)?[A-Za-z0-9.-]+(:[0-9]+)?|(?:ww‌​w.|[-;:&amp;=\\+\\$,\\w]+@)[A-Za-z0-9.-]+)((?:\\/[\\+~%\\/.\\w-_]*)?\\??(?:[-\\+=&amp;;%@.\\w_]*)#?‌​(?:[\\w]*))?)/"
        );
  </code></pre>
  
  <p>I have got very basic knowledge in regex, so I don't know whether the above used string is correct. Please help...</p>