I need to check if an URL is valid or not. The URL should contain some subdirectories like as:
example.com/test/test1/example/a.html
The URL should contain subdirectories test
, test1
and example
. How can I check if the URL is valid using regex in Java?