How to search and validate plain texts (where it starts with http AND ends with .aspx) to be a valid hyperlink in a page body content?
- by syntaxcode
My web page content is populated by a plain text that is retrieved from a CDATA format - plain text data.
This is the site http://checksite.apsx to get information.
For more information, visit http://moresites.com/FAQ/index.html or search the site.
Now, my goal is to convert this plain text to a valid hyperlinks.
I've used a javascript code that does the conversion - /((http|https|ftp):\/\/[^ ]+)/g;
, but sometimes if there are multiple words, it captures an invalid URL.
My question: Is there a way to strictly capture any string that starts with "http" AND ends with ".html" or "aspx" will be converted into a valid hyperlink?
it should look like this -
This is the site http://checksite.apsx to get information.
For more information, visit http://moresites.com/FAQ/index.html or search the site.