Search a file (simple grep clone)
On the whole your code seems pretty concise and clean.  I've just got a couple of side points.
Scope creep
This is a real problem in production code, where developers implement stuff that isn't really needed.  Your specification you've posted says 'take an exact string and an exact filename'.  You've allowed a regular expression to be passed.  The original requirements could have been met by just using strstr which would have made the code quite a bit smaller.  You've used extra time and added extra complexity, is there a real benefit?
The scope creep also means that I can't pass the basic string &quot;\n&quot; into your parser and have it find it as the '\n' is interpretted by the regex parser.  So, with grep I can do:

grep -F &quot;\n&quot; someFile.h

And get lines with the text \n:

printf(&quot;some text\n&quot;);

Whereas running your code:

./a.exe &quot;\n&quot; someFile.h

I get every line that ends in a newline (i.e. every line of the file).
-h -i and arguments
If you're going to implement programs that take in arguments, it's a good idea to give the user some way to find out what the arguments mean.  When I use grep -i, I'm trying to do a case-insensitive search.  Your program advertises a '-i' option, however it doesn't do the same thing as grep.  Instead I get told it can't open a file:

$ ./a.exe -i if someFile.h
if: could not open: No such file or directory