Hi all
whatI'm trying to accomplish is:
- separate link from other text inside variable and put it in new variable
- if in new variable is some text (if (stristr($MY_SELF, "/FCKeditor/File/")))
- take name of file from link (basename) (some html file)
- read content of that file (certain number) (file_get_contents)
- change link with new link (str_replace)
As you can see I'm missing only first part (separate link from other text inside variable)
how can I do it?
separate url link from other text inside variable
Moderator: General Moderators
On searching the forum, I got the following url.
Extract the particular regex which identifies a URL.
Use
This will replace the url with simple whitespace. Is this useful, if not let us know.
Extract the particular regex which identifies a URL.
Use
Code: Select all
preg_match($regex_for_url, $string_that_contains_url, $array_identifies_url);
//$array_identifies_url identifies and will contain the url
preg_replace($regex_for_url, ' ',$string_that_contains_url);