in reply to Deleting everything before a string

From the description of your algorithm, it sounds like you want $content to contain only a specific string if that string is contained within the file in question, right? Or do you really mean you want to replace everything else with whitespace, so that xxxJOHNxxx would be three spaces, JOHN, and then three spaces?

In the first case, how about

($file_text =~ /$string_to_match/) && $content = $string_to_match;
There's no need to do a substitution since you already know what you want the value of $content to be. Moreover, you probably have a default value in mind if the file fails to contain the match string, in which case you could use the ternary operator to do it:
$content = ($file_text =~ /$string_to_match/) ? $string_to_match : $default_failure_value;
Finally, if you know the file contains the text, and that's what you want in the $content variable, just do a simple assignment.

Update:
In case it's not obvious, I construed the question to imply that the matching string was known beforehand, rather than the delimiters. If the delimiters are what is known beforehand, my advice is, well, pointless.