Example:
QFile controller_selected_file(loaded_file);
if (controller_selected_file.open(QIODevice::ReadOnly))
{
// grab a data
QTextStream in(&controller_selected_file);
// read all
QString read_data = in.readAll();
// Regex for match function "public function something()"
QRegExp reg("(static|public|final)(.*)function(.*)[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]", Qt::CaseInsensitive);
// Read by regex and file
reg.indexIn(read_data);
QStringList data_render = reg.capturedTexts();
qDebug() << data_render;
qDebug() << data_render[0];
qDebug() << data_render[1];
qDebug() << data_render[3];
// ...
}
I want grab in a file all where appears public function somefunction()
and another public function something($a,$b = "example")
where appears in file, but I only receives full of file string or receive only public
on first array.
So I want grab all data where appears as arrays:
public function somefunction()
.
So in simple, parse all function names in file.
Full function of regex in QRegexp expression:
(static|public|final)(.*)function(.*)[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]
Edit: I want grab all appears in strings on PHP file. Problems appears when you receive all strings in file instead strings defined with regular expression.
Thank you for respect!