Capture links from any resource

How deep the script should go ?

Example: string,string2 - will return links containing these strings.