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
https://forums.phpfreaks.com/topic/264692-preg_match/
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
https://forums.phpfreaks.com/topic/264692-preg_match/#findComment-1356631
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.