Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex PowerShell,正则表达式:替换?_Regex_Powershell - Fatal编程技术网

Regex PowerShell,正则表达式:替换?

Regex PowerShell,正则表达式:替换?,regex,powershell,Regex,Powershell,我想替换一个号码,但它不起作用 $l = "prg=PowerShell°V=2.0°dtd=20120602°user=kjuz°pwd=jhiuz°chk=876876" $nxtDate = 20140526 $l -replace '°dtd=(d+)', '°dtd=$nxtDate' 这就是我得到的(2012年仍然没有变化) 我做错了什么? 这很有效: $l -replace '°dtd=(\d+)', "°dtd=$nxtDate" 我想你的d+


我想替换一个号码,但它不起作用

    $l = "prg=PowerShell°V=2.0°dtd=20120602°user=kjuz°pwd=jhiuz°chk=876876"
    $nxtDate = 20140526
    $l -replace '°dtd=(d+)', '°dtd=$nxtDate'
这就是我得到的(2012年仍然没有变化)

我做错了什么?
这很有效:

    $l -replace '°dtd=(\d+)', "°dtd=$nxtDate"

我想你的
d+
表达式下面缺少了一个
\
,如下所示:

°dtd=(\d+)

啊-是的,你是对的-很晚了,该睡觉了:(
°dtd=(\d+)