本帖最后由 rally 于 2022-8-19 10:26 编辑
bw=91.9MiB/s (96.4MB/s), 91.9MiB/s-91.9MiB/s (96.4MB/s-96.4MB/s), io=276MiB (289MB), run=3001-3001msec
bw=270MiB/s (270MB/s), 270MiB/s-270MiB/s (270MB/s-270MB/s), io=270MiB (289MB), run=3001-3001msec
用‘\d+\wMB/s' ,只能匹配出270MB/s , 而匹配不出96.4MB/s 类。这个带小数+指定字母的方式如何调整匹配呢?请路过的高手帮指点一下,谢谢!
#include <string.au3>
$str = 'bw=91.9MiB/s (96.4MB/s), 91.9MiB/s-91.9MiB/s (96.4MB/s-96.4MB/s), io=276MiB (289MB), run=3001-3001msec'
$string = stringregexp($str,'\d+\.+\wMB/s',3) ;这个想匹配出96.4MB/s
_arraydisplay($string)
$str = '270MiB/s (270MB/s), 270MiB/s-270MiB/s (270MB/s-270MB/s), io=270MiB (289MB), run=3001-3001msec'
$string = stringregexp($str,'\d+\wMB/s',3) ;这个想匹配出270MB/s
_arraydisplay($string)
我想改下正则表达式,通用96.4MB/s 、270MB/s (带小数和不带小数类型) ,这个正则表达式该如何改?
|