Skip to content

Instantly share code, notes, and snippets.

@aamsur-mkt
Created September 10, 2020 11:40
Show Gist options
  • Save aamsur-mkt/ddd8ecbc2fffcde43585d492c24a83f8 to your computer and use it in GitHub Desktop.
Save aamsur-mkt/ddd8ecbc2fffcde43585d492c24a83f8 to your computer and use it in GitHub Desktop.
Search Static String Variable with Regex
<?php
// regex untuk mencari static variable
$re = "/(?s)'(?:[^'\\\\]|\\\\.)*'|\"(?:[^\"\\\\]|\\\\.)*\"/";
$str = file_get_contents($_GET['file']);
preg_match_all($re, $str, $matches);
if(count($matches) <= 0){
return;
}
foreach($matches[0] as $m){
if($m != '""'){
echo ($m);
echo "<br/><br/>";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment