hi,
i am facing the problem with reuglar expressions. my requirement is if type the word like $var
in a input field and select the EXACT WORD radio button and i click the search button then i want to display all files with the word $var
all in my directory. using reuglar expressions in php.
i have wirtten the code here.just i am sending only preg_match_all
function.but my preg_match function is wrong. pls help me in this.
my code is :
if ($action == 'SEARCH_AND_REPLACE')
{
if ($strpos($line, $pattern) === false)
{
}
else
{
$temp_line = $line;
if(strstr($pattern,'$_')){
preg_match_all("/[[a-zA-Z](.*)\]/", $line, $out, PREG_OFFSET_CAPTURE);
}
else if(strstr($pattern,'$'))
{
$pattern_type=trim($_POST);
if($pattern_type == 'EXACT WORD')
{preg_match_all("/[a-zA-Z](.*) \=/", $line, $out,PREG_OFFSET_CAPTURE);
}
else
{
preg_match_all("/[a-zA-Z](.*)/", $line,$out,PREG_OFFSET_CAPTURE);
}
}
}
explanation :
In the above the code $pattern means which i enter the value in input field(Ex:$var)
.$line
means all files in my dir.
thanks in advance,
swap.