Re: regex for PHP variable name
- From: Sebosac <sebosac@xxxxxxxxxx>
- Date: Sat, 19 May 2007 11:35:49 +0200
Tom a écrit :
"Sebosac" <sebosac@xxxxxxxxxx> wrote in message
news:1179425971_309@xxxxxxxxx
hi, novice on regex, i'm searching for THE master Regex will retieve php
variable name like "$varname" in my script.
$tagparse = fil_gzet_contents('myscript.php');
preg_match_all("(.\$)", $tagparse, $out );
thank for your help
What at you trying to find in "myscript.php", any variable names? Maybe
something like this...
preg_match_all("/\$\S+/", $tagparse, $out );
Should do a pattern match for "$" and any not whitespace characters after
the dollar sign.
Tom
here what i'm trying to do :
"myscript.php" ccontaint someyhing like this :
$_Runtime_conf['config']['runtime']['_PRINCIPAL_CAT_SUBINDEXES_']=_CORE_MODULES_PRINCIPAL_MODULES_INDEXES($lien[1] );
foreach($_Runtime_conf['config']['runtime']['_PRINCIPAL_CAT_SUBINDEXES_'] as $dref){
//echo( "<a href=\"?p=".$dref[7]." \" class=\"poggle_blue\" > ".$dref[8]."</a> " );
echo("<li><a href=\"?p=".$dref[1]."\"> ".$dref[8]."<span></span></a></li>");
all_menu_site_map($dref);
}
and the reason of i need a regexp is to retrieve php Variable and Function name to Eval() them.
i work on a Content System Manager, atemplate like system, after all my try, a simple get_file_content, replace keywork and finish with eval() on php code was unsuccessful and eval set me to "error in eval's code at line 1", why, i can't explain this.
.
- References:
- regex for PHP variable name
- From: Sebosac
- Re: regex for PHP variable name
- From: Tom
- regex for PHP variable name
- Prev by Date: Warning: file_get_contents()...: URL file-access is disabled -HELP
- Next by Date: Hex Colour to RGB
- Previous by thread: Re: regex for PHP variable name
- Next by thread: PHP web design patterns
- Index(es):
Relevant Pages
|