diff --git a/model/mFormula.php b/model/mFormula.php index b7d7e6e..fb570c6 100644 --- a/model/mFormula.php +++ b/model/mFormula.php @@ -329,14 +329,18 @@ class mFormula extends mBase { $num_map = $GLOBALS['num_list']; $num_list = implode('', array_keys($num_map)); foreach ($herbString_arr as $herbString) { - $pattern = '/^(..)(.*?)([' . $num_list . ']+)([^(]*)?((.*?))?/u'; + $pattern = '/^(.)(.*?)([' . $num_list . ']+)([^(]*)?((.*?))?/u'; preg_match($pattern, $herbString, $matches); if ($matches) { + $herb_name = str_replace(array('(', ')'), '', trim($matches[1] . $matches[2])); + $herb_num = str_replace(array('(', ')'), '', trim($matches[3] . $matches[4])); + $herb_desc = isset($matches[5]) ? str_replace(array('(', ')'), '', trim($matches[4])) : ""; + $herb_arr[] = array( - 'herb_name' => trim($matches[1] . $matches[2]), - 'herb_num' => trim($matches[3] . $matches[4]), - 'herb_desc' => isset($matches[5]) ? str_replace(array('(', ')'), '', trim($matches[5])) : "", + 'herb_name' => $herb_name, + 'herb_num' => $herb_num, + 'herb_desc' => $herb_desc, ); } else { $herb_arr[] = array( @@ -345,7 +349,6 @@ class mFormula extends mBase { 'herb_desc' => "", ); } - } return $herb_arr;