如何执行neo4j密码格式化

时间:2016-09-22 18:57:13

标签: neo4j cypher

是否有方法/网站/崇高插件等,以格式化密码(使其对齐和整洁)?

与此网站为javascript做的相同,例如: http://jsbeautifier.org/

1 个答案:

答案 0 :(得分:2)

虽然不完美,但这就是我一直在做的事情。 (希望其他人会加入并改进它)



var Cypher = document.body.innerText
Cypher = Cypher.replace(/(?:\s*(OPTIONAL MATCH|MATCH|WHERE|WITH|RETURN|DETACH DELETE|DELETE|UNWIND|CASE)\s*)/gi, function(match) {
  return '\n' + match.toUpperCase() + ' '
});

Cypher = Cypher.replace(/(?:\s*(AND|NOT|DISTINCT)\s*)/gi, function(match) {
  return ' ' + match.toUpperCase().trim() + ' '
});

Cypher = Cypher.replace(/(?:\s*(\w+)\(\s*)/gi, function(match) {
  return ' ' + match.toUpperCase().trim()
});

document.body.innerText = Cypher

match (n), (n)--(m) where n.car=1 and not n.id="rawr" with n.name return collect(n) as cars




JSFiddle version