in reply to Re: Finding C++ single inheritance occurrances
in thread Finding C++ single inheritance occurrances

Typically, you would provide a LIST to grep, instead of a single scalar.

Conversely, if one only has one string to match, one wouldn't use grep.

my @matches = $string =~ /(?:class|struct)\s+[^:{;]+:[\w<>\s]+{/g;