Hello,

I tried to use regex to search through

blablablablahttp://www.myspace.com/username

by using

preg_match('~http://www\.myspace\.com/.+"~',$string,$match);

The tilde or lack of was tripping me up... am I even close?
I was just trying to extract the username at the end, before it was marked off by a double quote ("). I tried adapting this answer from a previous forum post but it doesn't seem to be working. Any help would be appreciated.

Thanks,

L

Thanks so much, I'll test it out and see if I can get it working, I should be able to.

I don't know how to tie it in to

else {

	$timeout = 300;

	ini_set('max_execution_time','120');

	set_time_limit(120);

	ini_set('default_socket_timeout','120');

	while($contents = fread($handle,'1024'))

	{ $hold .= $contents; }

above it. Could anyone tell me what function the ~ serves? I don't see it in any regex guides.

The tilde has no special meaning, it was just chosen as the delimiter so the slashes didn't have to be escaped. You can choose pretty much any delimiter.

$regex1 = '/http:\/\/www\.example.com\/blah/';
// vs
$regex2 = "#http://www\.example\.com/blah#';

I prefer to use / and # but it looks like the tilde was their choice.

This question has already been answered. Start a new discussion instead.