Good afternoon:
I'm picking up the value of calls to a particular PHP function straight from the source code.
What I need is to scan each of the lines of the source code, and if there are one or more altext () function calls, get the argument passed. For example:
<img alt="<?php echo altext('[Este é um texto alternativo]');?>">
In the example case, I need to be returned only "This is alternate text" (without quotes). The [] were placed to avoid that, if there is a ') in the middle of the text, the search stops before the end.
I'm trying to use preg_match_all("/\[altext\]\(\'\[(.*)\]\'\)/", $data, $matches);
but it's not returning anything. $data
is the line of code I'm looking for from the source code with fgets
.