I am using a file search utility (FileSeek) with regex content search.
The contents I am searching for is basically any un-commented lines that have while...each
in them.
I have successfully managed to exclude inline commented lines such as // while (list($key, $value) = each($_GET))
with this regex: ^(?:(?!\/\/).)*while.+[\s=(]each[\s(]
How can I improve the regex search (make it even more restrictive) to exclude search results from commented lines and commented code blocks \* *\
such as:
/*
while (list($key, $value) = each($_GET))
*/
Or
/* some code
while (list($key, $value) = each($_GET))
some code
*/
In other words, how can I modify my regex to also completely skip/ignore everything inside a commented php block: \* *\
instead of picking up results that are also inside it?
EDIT: Just for reference, here is an example that does the opposite, ie. matches only commented code.