What is the easiest and fastest way to check if a string is a single URL or TEXT (which may contain URLs)
possible scenarios:
$example[] = 'http://sub-domain.my-domain.com/folder/file.php?some=param';
$example[] = '/assets/scripts/jquery.min.js?v=1.4';
$example[] = 'jquery.min.js';
$example[] = "http://www.domain.com welcome text\n and some other http://www.domain.com";
$example[] = "scriptVar=50;";
I tried using my own php functions like parse_url, filter_var, but not all of them work properly.
UPDATE 1
To make this clearer, I'm trying to separate a possible URI from script content that will be inserted as a DOM element. All URLs will display as an SRC attribute and remain as content, for example:
<script type="text/javascript" src="{$string}"></script>
<script type="text/javascript">{$string}</script>
UPDATE 2
Analyzing the possible contents, I came to the conclusion that a line containing a space character or a semicolon means that the line cannot be a URI, I believe this pattern can solve my problem:
preg_match('/[\s]|[;]/', $string);
javascript/css?