Reply to why does this regular expression fail?

Your name:

Reply:


Posted by lawrence k on 11/09/06 01:37

Suppose I have these five lines in a file somewhere:

<p>This entry should belong to:
<select name="formInputs[id_of_neighborhood_to_which_this_belongs]">
<option value="">(No choice made)</option>
<?php getDatabaseTableValuesInOptionTags("neighborhoods", "id",
"state"); ?>
</select>

Suppose I open this file and read the contents into a string called
$string. Suppose I then give the string to this function:


function matchAllPhpFunctionsInString($subject=false) {
// 11-08-06 - this is being called in importForm

$pattern = "<";
$pattern .= "\?php.*\(.*\); \?";
$pattern .= ">";
$pattern = "/$pattern/";
preg_match_all($pattern, $subject, $matches);
// print_r($matches);

// 09-19-06 - there is no point returning a 2 dimensional array, so we
will make
// it one dimensional.
$arrayOfPhpFunctionNames = $matches[0];
return $arrayOfPhpFunctionNames;
}



This function is suppose to find the PHP command. It works on other
pages, but not the one I've posted above. Why is that? Why would this
regular expression not find this PHP command?

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация