JuJ*_*oDi 1 php regex preg-match
我有一个字符串,从file_get_contents()调用,包含如下内容:
<span class="cb_price_countdown cb_lot_price_1439066">$40.65</span>
Run Code Online (Sandbox Code Playgroud)
我想提取价格40.65.我不熟悉正则表达式或preg_match所以我很难过.到目前为止,我尝试过:
$pattern = "/\\\$?((\d{1,3}(,\d{3})*)|(\d+))(\.\d{2})?$/";
preg_match ($pattern, $subject, $matches);
print_r ($matches);
Run Code Online (Sandbox Code Playgroud)
哪个没有返回任何有用的东西,我试过:
$pattern = "/[\d+|\d+,\d+]\.\d{0,2}/";
Run Code Online (Sandbox Code Playgroud)
但这是同一个故事.有人可以告诉我正在寻找的正确的preg_match模式吗?
谢谢你,
贾斯汀
| 归档时间: |
|
| 查看次数: |
2090 次 |
| 最近记录: |