I have some .php files in a directory that calls a user defined function:
_l($string);
each time different string is passed to that function and all strings are static, (i.e. not a single string is entered by user input).
Now I want a script that can list down all the strings form all the files of that directory, which are passed into _l($string);
I had tried:
$fp = fopen($file, "r");
while(!feof($fp)) {
$content .= fgets($fp, filesize($file));
if(preg_match_all('/(_l('.*?');)/', fgets($fp, filesize($file)), $matches)){
foreach ($matches as $key => $value) {
array_push($text, $value[0]);
}
}
}
I get strings but not every strings those are in files, some strings are not match with given regex, so what are the condiotion that is required to get all the strings?
question from:
https://stackoverflow.com/questions/66058013/how-to-find-particular-pattern-using-regex 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…