Page 1 of 1

separate url link from other text inside variable

Posted: Thu Mar 22, 2007 6:39 am
by ddragas
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?

Posted: Thu Mar 22, 2007 7:03 am
by dude81
On searching the forum, I got the following url.
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);
This will replace the url with simple whitespace. Is this useful, if not let us know.

Posted: Thu Mar 22, 2007 7:49 am
by feyd
duplicate post = uncool.

viewtopic.php?t=65324