Jump to content

preg_match()


stijn0713

Recommended Posts

i get this error: preg_match(): Delimiter must not be alphanumeric or backslash, when i run the following code:

 

function zetjuistvolgorde($SandTs){

$arr1 = array();
$arr2 = array();	

for ($i = 0; $i <= count($SandTs); $i++){

	if(preg_match('t.', "{$SandTs[$i]}")){
		$arr1 = $SandTs[$i];
	}
		else {
			$arr2 = $SandTs[$i];
		}	
} 
$arr = array_merge($arr1, $arr2);
return $arr;
}

 

The purpose is that an array which countains variables like e.g. t1 t2 s1 s2 t3 s3 will be sorted so that all the t's comes first. Apparently it doesn't work but i have no clue what the error means. Can somebody help me?

 

Thanks in advance

Link to comment
Share on other sites

The preg_match() page already links through to the "PCRE Patterns" chapter, from there it should not have proved tricky (though clearly did) to find what you needed.  Two of the four further links on that ("PCRE Patterns") page mention delimiters, and take you right to the detailed information about them.

 

I can only advise that people read through the PCRE Patterns chapter before trying to use the associated functions.

 

A link could be added from the preg_match() page directly to the "Delimiters" page, but where do we draw the line? Should the function page also link to the Performance, Repetition, Character classes, ... pages?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.