检测字符串的一部分

时间:2015-04-06 09:53:33

标签: php regex string

我想检测一部分字符串

Smith-Waterman score: 275; 46.8% identity (78.5% similar) in 79 aa overlap (1-78:26-103)

我想检测 46.8%并将其作为浮点值存储在变量中

我应该使用什么样的正则表达式?

1 个答案:

答案 0 :(得分:0)

$a = preg_match('/[0-9]{2,2}.[0-9]{1,1}\%/','Smith-Waterman score: 275; 46.8% identity (78.5% similar) in 79 aa overlap (1-78:26-103)',$ab);
print_r($ab);