我正在尝试首次使用NSIS Modern User Interface创建安装程序.我想知道如何添加一个选项(复选框)供用户选择在完成页面(安装程序的最后一个屏幕)上创建桌面快捷方式,以及已经存在的"运行XXXX"选项.
我试图在Perl中提出一个匹配多个模式的正则表达式,并像preg_match_allPHP 一样返回所有这些模式.
这就是我所拥有的:
$str = 'testdatastring';
if($str =~ /(test|data|string)/) {
print "its found index location: $0 $-[0]-$+[0]\n";
print "its found index location: $1 $-[1]-$+[1]\n";
print "its found index location: $2 $-[2]-$+[2]\n";
print "its found index location: $3 $-[3]-$+[3]\n";
}
Run Code Online (Sandbox Code Playgroud)
这只给了我第一场比赛,其中就是'测试'.我希望能够匹配所有出现的指定模式:'test','data'和'string'.
我知道在PHP中,你可以使用preg_match_all来达到这种目的:
if(preg_match_all('/(test|data|string)/', 'testdatastring', $m)) {
echo var_export($m, true);
}
Run Code Online (Sandbox Code Playgroud)
上面的PHP代码将匹配所有3个字符串:'test','data'和'string'.
我想知道如何在Perl中执行此操作.任何帮助将不胜感激.
在我的函数update-replace中,我试图通过调用xdmp:node-replace如下所示动态替换MarkLogic中我的一个XML数据源文件中的XML节点:
declare function update-lib:update-rec($doc as xs:string, $path as xs:string, $country as xs:string, $name as xs:string, $population as xs:integer, $latitude as xs:decimal, $longitude as xs:decimal) as document-node() {
(: read lock acquired :)
fn:doc($doc),
xdmp:node-replace(fn:doc($doc)/$path,
<city>
<country>{$country}</country>
<name>{$name}</name>
<population>{$population}</population>
<latitude>{$latitude}</latitude>
<longitude>{$longitude}</longitude>
</city>
),
(: after the following statement, txn ends and locks released :)
xdmp:commit()
};
Run Code Online (Sandbox Code Playgroud)
该函数采用7个参数,第一个arg是XML源文件的路径,第二个是XML文件中要更新的节点的路径,其余的对应于子元素值.
当我调用xdmp:node-replace更新数据时,遇到以下错误:
500内部服务器错误
XDMP-ARGTYPE:(错误:XPTY0004)xdmp:node-replace("/ cities/city [3961]",JPMiyoshi56958) - arg1不是node()类型...
所以我决定对arg1进行评估,以确保node()作为node-replace的第一个arg传递:
xdmp:node-replace(xdmp:eval(fn:doc($doc)/$path),
<city>
<country>{$country}</country>
<name>{$name}</name>
<population>{$population}</population>
<latitude>{$latitude}</latitude>
<longitude>{$longitude}</longitude>
</city>
),
Run Code Online (Sandbox Code Playgroud)
现在我收到以下错误: …