Depends on how consistant your data is, how many occurances there are and what your are attempting to parse.
If you are feeding it in through a variable, you need to use some sort of trim() function to extract the information you want.
I take it your trying to parse a document, since this looks like an html href.
If so, you have to first pull your document into a PHP file like so:
// Open the file
$file = fopen("$URL", "r");
// read file 32K
$import = fread($file, 32000);
// Close the imported file
fclose($file);
\"<a\" and \"</a>
Once you have your document imported you have to decide how you want to work with it. If there are multiple occurances of
\"<a\" or \"</a> you will probably want to parse the file line-by-line.
If not, you simply have to run an ereg() function on your file and look for \"<a\" and \"</a>, like so:
eregi("(\"<a\")(.*)(\"</a>)", $import, $output);
I'm think $output becomes an array after this. If so, ereg will put your search and everything between it into an array.
Either $output or $output[0]; If I'm right about it being an array, then the later.
If your requested search appears more than once, you've got a bigger problem because ereg() will get 'greedy' and pull everything between the first occurance of your search and the very last. Thus, you'll get much more information than you want.
One way to work around this is to parse the file line-by-line. If you can identify where your data is going to be every time you perform a parse, it helps greatly.
To parse line-by-line, you have to create a loop similar to this: (This will start on line 40 of your document and parse everything between line 40 and line 60, looking for the first occurance of \"<a\")
$file = file("$URL");
$line = "40";
while ($line <= 60) {
if(strstr($file[$line],"\"<a\"")) {
$myline = $file[$line];
$line++; } else {
$line++;
}
}
You will then have to run the above ereg statment on the variable $myline. If you want to get rid of the <a and /a> within your varible you can use either trim(), maybe a substr_replace.
Hope that helps.