encontrar todas las apariciones de requerido e incluido en un archivo php

Entiendo preg_match_all can get me this information. I need

include("xxxx");
include_once("xxxx");
require("xxxx");
require_once("xxxx");

and any other permutations allowed by PHP that I may not know of.

Not having much luck building the expression.

preguntado el 10 de marzo de 12 a las 14:03

es en realidad require("xxxx"); y require_once("xxxx"); not required -

I did not understand what the result must be but if you need to get xxxx in the result you can use: preg_match_all('/(include|include_once|require|require_once)\("([^"]*")\)/', $source_text, $result); -

1 Respuestas

Prueba este:

(include|require)(_once)?[( ]["'].+["']\)?;

But I wouldn't rely on RegEx to do this kind of job.

respondido 10 mar '12, 19:03

You should also consider single quotes. so ["'] instead " - gintas

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.