First program your own version of it, then look at the guts of grep and be amazed at how elegant that solution to the problem is.
And if you come up with the same solution without peeking you will probably be able to name your own price at some point.