在正则表达式中这可能吗? 假设我收到了这些条目:
1005,15,0,0,0
1014,20,0,0,0
1084,3,360000,180000,1
1025,5,0,0,0
我应该拥有的是,找到一个在它之前有逗号的数字,0,0,0并且在此之后,将数字替换为其数字的140%
1005,15*1.4,0,0,0
1014,20*1.4,0,0,0
1084,3,360000,180000,1
1025,1*1.4,0,0,0
如果它有小数点,将其向上舍入1,并删除小数点,以便:
1025,1,0,0,0 => 1025,2,0,0,0
决赛应该是这样的:
1005,21,0,0,0
1014,28,0,0,0
1084,3,360000,180000,1
1025,2,0,0,0
有人可以请我正确的正则表达式查找和替换?
谢谢!
编辑:弄清楚正则表达式无法做到这一点,所以任何可以帮助我的工具?
我这里有一个描述问题的代码,我需要在我的变量上运行file_get_html(),有效的参数必须有' http://google.com '我的变量只在域开始 - >添加http://和/ ,但在你可以看到它不起作用,它结束给予:
Warning: file_get_contents('http://google.com/'): failed to open stream: Invalid argument ... simple_html_dom.php on line 75
Run Code Online (Sandbox Code Playgroud)
这是代码
require_once('/simplehtmldom_1_5/simple_html_dom.php');
$a = 'google.com'; //from domain only: google.com
$b = "'http://" . $a . "/'"; //then, modify to have this form: http://google.com/
//$html = file_get_html($b); //this thing doesn't work
$html = file_get_html('http://google.com/'); // but this thing works
Run Code Online (Sandbox Code Playgroud)