我想是的后面是一个关键的词“量”正则表达式查找后面
preg_match_all("/amount.+\b(\d+(\.\d+)?)/im", $input_lines, $output_array);
我输入的数据是
here is some number 100.25
that does not 200.
but this amount should be captured 300.
and this amount should be captured 400.25 too
and this amount should be captured $5023 too
and this amount should be captured $60.25 too
and this amount should be captured 700.25.
But not this amount 800.25.2
文本中捕捉数量的关键词数量
所以只有数字300,400.25,5023,60.25,700.25应该被捕获
我想我想通拿出你想要的东西,但你应该真正解释数字应该与不应该匹配的逻辑。 – Theo