字符串:
php code sw design and iss scrum team 2
lr rf & hw modules->lr wcdma cpri baseline->lr cpri misc.->sw dev and test
求将 lr rf & hw modules,lr wcdma cpri baseline, lr cpri misc. ,sw dev and test 这四个取出来的正则,以及只取出lr rf & hw modules的正则表达式。
我在php里用的函数是preg_match.
谢谢了!!
------解决方案--------------------
php code$str=sw design and iss scrum team 2
lr rf & hw modules->lr wcdma cpri baseline->lr cpri misc.->sw dev and test html;//echo $str;quit();preg_match_all('/(?:\s+|->)]*>(.*)/isu',$str,$arr);print_r($arr[1]);
------解决方案--------------------
$text=array();
$html=sw design and iss scrum team 2
lr rf & hw modules
lr wcdma cpri baseline
lr cpri misc.
sw dev and test;
preg_match_all('|program\/domain\/bu\'>(.+)|',$html, $matches);
$text[0]=$matches[1][0];
preg_match_all('|technical domain\'>(.+)|',$html, $matches);
$text[1]=$matches[1][0];
preg_match_all('|project\'>(.+)|',$html, $matches);
$text[2]=$matches[1][0];
preg_match_all('|title=\'team\' >(.+)|',$html, $matches);
$text[3]=$matches[1][1];
print_r($text);
------解决方案--------------------
(?:expression) 非捕获组 进行子表达式expression的匹配,并将匹配内容保存到最终的整个表达式的区配结果中,但expression匹配的内容不单独保存到一个组内
| 或的意思