$regex = '!\.LatLng\(\s*(\d+\.\d+)\s*,\s*(\d+\.\d+)\)!'; preg_match($regex, $str, $match); $lat = $match[1]; $lng = $match[2];