Regular expression
- by atno
Hi
I have an array that its first element might contains something like [some text, here. That's some text]
I'm trying to figure out a pattern to check if such string exists and if not create it but having problem with making the pattern. Here's what I've done so far
$pattern = '/^\[*\]$/';
if(preg_match($pattern,$exploded[0])){
$name = array_shift($exploded);
}else{
$name = "[Unnamed import] - " .gmdate("His");
}
But I always get [Unnamed import] - 032758 even when I'm sure that pattern match