Jump to content

In a text there's (possibly) one URL inside <a> tags. Need to validate that URL.


nonhocapito

Recommended Posts

The user submits some text that, to his/her discretion can contain a url in the form of <a href="someurl">some text</a>.

 

I need to know if "someurl" is a valid url.

 

Consider that:

the "<a>" tag and the url might not even be there;

a crazy user might even have created more than one url;

 

I cannot run a regex to extract URLs from text (I found some on the web) because that regex naturally looks for valid URLs: but the url I am looking for (if any) is invalid!

 

The only clue I think is the presence of the "<a>" tags. Found those, the regex should look for the "href" attribute tags and then validate.

I'm no good at regex and can't say how all this should happen.

 

Any ideas?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.