Reputation: 372
I am currently searching through an HTML page for a specific link, at the moment I have a regex as follows that picks up a generic URI:
Regex regex = new Regex(@"(https?|ftp|file)\://[A-Za-z0-9\.\-]+(/[A-Za-z0-9\?\&\=;\+!'\(\)\*\-\._~%]*)*");
Although there are several links in the HTML so it picks out the first one, where as the link I want to extract is as follows:
http://*.*.com/dlp/*/*/*
How could this be achieved using a regex?
Upvotes: 0
Views: 937
Reputation: 30872
Try this:
http\://[A-Za-z0-9\.\-]+\.com/dlp[A-Za-z0-9\.\-/]*
You may need to escape some characters again.
Upvotes: 1