小编The*_*olf的帖子

查找模式并替换PLUS操作?

在正则表达式中这可能吗? 假设我收到了这些条目:

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

有人可以请我正确的正则表达式查找和替换?

谢谢!

编辑:弄清楚正则表达式无法做到这一点,所以任何可以帮助我的工具?

csv vim notepad++ delimiter

1
推荐指数
1
解决办法
87
查看次数

将变量传递给file_get_html在Simple DOM中不起作用

我这里有一个描述问题的代码,我需要在我的变量上运行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)

php simple-html-dom

0
推荐指数
1
解决办法
976
查看次数

标签 统计

csv ×1

delimiter ×1

notepad++ ×1

php ×1

simple-html-dom ×1

vim ×1