1、JS代码:
var field_regex=/(涉及).+(领域)/;
var method_regex=/(涉及一种).+(方法)/;
field_match=tech_field_str.match(field_regex);
if(field_match!=null)
{
field_result=field_match[0].replace(field_match[1],"");
field_result=field_result.replace(field_match[2],"");
method_match=tech_field_str.replace(field_match[0],"").match(method_regex);
if(method_match!=null)
{
method_result=method_match[0].replace(method_match[1],"");
method_result=method_result.replace(method_match[2],"");
patent_array.push([method_result,field_result,company_name]);
}
}
2、PHP代码:
$field_regex='/涉及(.*?)领域/';
$method_regex='/涉及一种(.*?)方法/';
foreach ($chosen_patent as $data) //获得patent_array
{
preg_match($method_regex, $data[0], $method_matches);
preg_match($field_regex, $data[0], $field_matches);
if(count($method_matches)>=1 and count($field_matches)>=1)
{
array_push($mylist,$method_matches[1],$field_matches[1],$data[1]);
array_push($patent_array,$mylist);
$mylist=$this->my_pop($mylist,3);
}
}