I'm trying to match this string but hitting a few problems? The string: complete_str += 'ar.com%2fcached%2fs%22%3e%0d%0a%3c%2fSCRIPT%3e'; Code (markup): What I'm using: $html = @file_get_contents("$jsUrl"); preg_match_all('~complete_str += \'(.*?)\';~s', $html, $titleMatches); foreach ($titleMatches[1] AS $titleMatch) { echo "complete_str: $titleMatch<br /><br />"; } Code (markup):
You need to escape "+". Because it has special meaning. preg_match_all('~complete_str \+= \'(.*?)\';~s', $html, $titleMatches)