环回正则表达式无效。
我有格式为
的字符串public function upload()
{
//image upload
$config['upload_path'] = './images';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$this->load->library('upload',$config);
$this->upload->initialize($config);
$fileInfos = array();
$errors = array();
//uploading
if (! empty($_FILES['images']['name']))
{
$photosCount = count($_FILES['images']['name']);
for ($i = 0; $i < $photosCount; $i ++)
{
$_FILES['image']['name'] = $_FILES['images']['name'][$i];
$_FILES['image']['type'] = $_FILES['images']['type'][$i];
$_FILES['image']['tmp_name'] = $_FILES['images']['tmp_name'][$i];
$_FILES['image']['error'] = $_FILES['images']['error'][$i];
$_FILES['image']['size'] = $_FILES['images']['size'][$i];
if ($this->upload->do_upload('image'))
{
array_push($fileInfos, array(
'fileInfo' => $this->upload->data()
));
$filename =$_FILES['image']['name'] ;
//$filename =$_FILES["name"].$_FILES["type"];
// $data['fileInfos'] = $fileInfo;
$this->load->model("ProductmModel");
$this->ProductmModel->IMAGE = $filename;
}
else
{
array_push($errors, array(
'error' => $this->upload->display_errors()
));
}
}
}
$pname = $this->input->post("name");
$pdes = $this->input->post("pdes");
$caty = $this->input->post("category");
$subcat = $this->input->post("subcat");
$this->ProductmModel->PRODUCTNAME = $pname;
$this->ProductmModel->DESCRIPTION = $pdes;
$this->ProductmModel->CATEGORY = $caty;
$this->ProductmModel->SUBCAT = $subcat;
$this->ProductmModel->addproductm();
}
我想沿“,”分割,除非“,”位于f(x,y)之类的函数中,即除非被()包围
我尝试匹配相关的“”,如下:
a,b,f(x,y),c,h(u,v,w),d,e,...
此操作失败,因为回溯的长度不是固定的。然后我尝试了
(?<!\([^\)]*),(?![^\(]*\))
这有效,但是我不明白这里如何解释“ 100”。它似乎不被解释为“恰好100次出现”。真的是怎么做到的?