-2

What is wrong with this regex expression? I keep getting the error 'delimiter must not be alphanumeric or backslash' despite escaping with /i.

$tokenregex = '/sid(.*)/i';


$bizresponse=curl_getinfo ($curlop1);
$bizresponse = print_r($bizch);


if (preg_match($tokenregex[1], $bizresponse))

{
do things
}

bizresponse is this

ttp://anonymouse.org/cgi-bin/anon-www.cgi/http://ca.isohunt.com/member.php?origin=/forum/index.php&ssl=no&sid=915625588370db24a51d713871a3ec1a [content_type] => text/html; charset=utf-8 [http_code] => 200 [header_size] => 1417 [request_size] => 627 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 1 [total_time] => 2.666479 [namelookup_time] => 3.8E-5 [connect_time] => 0.168507 [pretransfer_time] => 0.168547 [size_upload] => 0 [size_download] => 39526 [speed_download] => 14823 [speed_upload] => 0 [download_content_length] => 415 [upload_content_length] => 0 [starttransfer_time] => 0.778169 [redirect_time] => 1.383665 [certinfo] => Array ( ) [redirect_url] => )

space ranger
  • 422
  • 1
  • 8
  • 21

1 Answers1

-1

In if (preg_match($tokenregex[1], $bizresponse)) , the value of $tokenregex[1] is s which is creating error here. Replace $tokenregex[1] with $tokenregex

Ravi
  • 2,078
  • 13
  • 23
  • problem is that there $tokenregex is an array and I am only trying to get the 2nd one, any other way unless changing tokenregex pattern to be more specific? – space ranger Nov 23 '12 at 05:14
  • Your `$tokenregex` doesn't seems to be an array, use this `$tokenregex[] = '/sid(.*)/i';` instead of `$tokenregex = '/sid(.*)/i';` – Ravi Nov 23 '12 at 05:18