while () { / ( #Start capture ( #Start Sub descript header '\*{20,} #start '------ delimiter (\n'[^\n]*?)+\n #middle of header '\*{20,}\n #end '------ delimiter )? #End Sub header (optional) (Private\s|Public\s|Friend\s)? #Scope (optional) (Static\s)? #Static (optional) (Sub\s|Function\s) #Sub or Function (mandatory) [^\n]+ #more stuff on same line (?!\sLib\s) #but not if Lib on line .* #and the rest of the file ) #End capture /sx and print "[$6/$7/$8]\n"; }; __DATA__ Private Declare Function DeleteFile Lib "kernel32" Alias "DeleteFileA" _ #### while () { print; / ( #Start capture ( #Start Sub descript header '\*{20,} #start '------ delimiter (\n'[^\n]*?)+\n #middle of header '\*{20,}\n #end '------ delimiter )? #End Sub header (optional) (Private\s|Public\s|Friend\s)? #Scope (optional) (Static\s)? #Static (optional) (Sub\s|Function\s) #Sub or Function (mandatory) (\w+)\s+ # sub name ((?!Lib\s)) #no Lib on line ([^\n]+) #more stuff on same line unless "Lib" (.*) #and the rest of the file ) #End capture /sx and print "[$6/$7/$8]"; }; __DATA__ Private Declare Function DeleteFile Lib "kernel32" Alias "DeleteFileA"