So I was getting “Parse Error: syntax error, unexpected $end filename on line linenum” In a wordpress plugin. The file was working correctly on my live server but not on xampp and the line number was the last line of the file. A bit of googling searching pointed me to the issue being a mixture of <? and <?php.
So if you come across the issue, and don’t want to manually search through your 2000 line file to find the offending tag, the following regular expression will find those naughty <? tags
<?[^p]