The purpose of the regex search is to determine all template class instances from C++ header files. The class instances can be formarted such as:
CMyClass<int> myClassInstance;
CMyClass2<
int,
int
> myClass2Instacen;
The search is performed by loading the entire file into a string:
open(FILE, $file);
$string = join('',<FILE>);
close(FILE);
And the following regex is used to determine the class instances even if the class instance spans more then one line in the string:
$search_string = "\s*\w[^typename].*<(\s*\w\s*,?\n?)*)>\s*\w+.*";
$string =~ m/$search_string/;
The problem is that the search returns one hit only even though more class instances exist in the files.
Is it possible to get all hits by use of this approach from one of the regex backreferences variables?