in reply to Re: regex man they are tough
in thread regex man they are tough

I prefer to use regexps instead of your example due to brevity of handling the failure cases. Even so, you can tweak yours to be a bit more resilant.

This bit doesn't take into account not having 30 characters before the search string:

$idx = index( $line, "Search String", 16 );
Since we know there must be 30 bytes of data before the Search String, do this:
$idx = index($line, "Search String", 16+30);
The same idea is true for the "third_part" bit in your code and isn't hard to handle.