I am using preg_match_all
, trying to match :
[<? or <?php]
[any amount of space here, at least one, may be newline]
[legendcool]
[any amount of space]
[(] return whatever is in here [)]
[any amount of space]
[?>]
I have this so far:
index.php
$the_prophecy = file_get_contents("secret.php");
preg_match_all('~[<?|<?php]\s*[legendcool(](.*?)[)]\s*[?>]~',$the_prophecy,$matches) ;
secret.php
<title>Regex Match all characters between two strings - Stack Overflow</title>
<link rel="shortcut icon" href="http://cdn.sstatic.net/stackoverflow/img/favicon.ico">
<?php legendcool({'',''}) ?>
<link rel="apple-touch-icon image_src" href="http://cdn.sstatic.net/stackoverflow/img/
For example, in secret.php, I would want to get {'',''}
Do any of you guys know how I can adjust my preg_match_all
to work in the way I want?