On Tue, Nov 08, 2022 at 12:21:17PM -0400, Jason Gunthorpe wrote: > On Tue, Nov 08, 2022 at 03:25:10PM +0000, Matthew Wilcox wrote: > > On Tue, Nov 08, 2022 at 11:02:35AM -0400, Jason Gunthorpe wrote: > > > (I don't know perl at all so happy to replace this with something more elegant) > > > my $export_symbol = '^\s*EXPORT_SYMBOL(_GPL)?\s*\(\s*(\w+)\s*\)\s*;'; > > > +my $export_symbol_ns = '^\s*EXPORT_SYMBOL_NS(_GPL)?\s*\(\s*(\w+)\s*,\s*\w+\)\s*;'; > > > > How about: > > > > -my $export_symbol = '^\s*EXPORT_SYMBOL(_GPL)?\s*\(\s*(\w+)\s*\)\s*;'; > > +my $export_symbol = '^\s*EXPORT_SYMBOL(_NS)?(_GPL)?\s*\(\s*(\w+)\s*\)\s*;'; > > > > Not them i'm a perlite either, but this is just a regexp. > > I started like that, but the target text looks like this: > > EXPORT_SYMBOL_NS_GPL(iommufd_access_destroy, IOMMUFD); > > And the (\w+) capture should only pick "iommufd_access_destroy", so > the ideal regex does the ",\s*\w+)" part only if _NS was matched > earlier. Oh, right, I missed that part of the regex difference. How about terminating the match with [,)]? ie: +my $export_symbol = '^\s*EXPORT_SYMBOL(_NS)?(_GPL)?\s*\(\s*(\w+[,)]\s*\)\s*;';