我目前正在探索Neo4j的爱好项目;当该字段中包含括号时,我在某个字段上获得完全匹配时会遇到一些问题:
create (:Employee { name: "abcd", department: "Human Resources (Recruitment)" });
match(n:Employee) where n.department =~ '.*\\bHuman\\b.*' return n
这是有效的,但如果一个节点有括号,例如:
{{1}}
这不会返回任何内容。
如果我做错了什么,能帮助我吗?
答案 0 :(得分:1)
我认为你应该使用'.*Human.*'
作为正则表达式,因为它更清晰,不需要字边界。
这符合您的情况,因为它不会查找跟随Human
或nothing
或many
字符的'.*\\bHuman\\b.*'
。
如果您想添加单词边界,请按照.*\bHuman.*\b
为什么你的正则表达式不起作用?
你的正则表达式word boundary
正在检查字符串末尾的Human Resources (Recruitment)
。并且您的字符串)
与之匹配,因为在t
之后匹配边界后遗漏了最后一个字符<?php
error_reporting(E_ALL);
ini_set('display_errors',1);
$sck=socket_create(AF_INET,SOCK_STREAM,SOL_TCP);
if($sck===FALSE){
die('socket_create failed!');
}
if(!socket_set_block($sck)){
die("socket_set_block failed!");
}
if(!socket_bind($sck, '0.0.0.0',1337)){
die("FAILED to bind to port 1337");
}
if(!socket_listen($sck,0)){
die("socket_listen failed!");
}
$fullFile='';
while((print('listening for connections!'.PHP_EOL)) && false!==($conn=socket_accept($sck))){
echo "new connection!".PHP_EOL;
echo "generating crypto iv..";
while(false!==($buffi=socket_recv($conn,$buff,1024,MSG_WAITALL))){
if($buffi===0){
break;//socket_recv's way of
//saying that the connection closed,
//apparently. the docs say it should return
// false, but it doesn't, it just infinitely returns int(0).
// at least on windows 7 x64 sp1.
}
$fullFile.=$buff;
echo "recieved ".strlen($fullFile)." bytes...".PHP_EOL;
$buff='';//do i need to clear it? or wiill recv do it for me?
}
echo "all bytes recieved (i guess, todo, socket_last_error confirm).";
echo PHP_EOL;var_dump($fullFule);
echo "done!".PHP_EOL;
}
die("should never reach this code...");
。