Actually "grep -p" has been a fixture in AIX for the last two decades from what I can recall. It is out there, and it's just a matter of porting the behaviour over in fresh code.
It's crude, though, and may need help to know that blank lines within a function don't count.