如何执行neo4j密码格式化

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

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

最佳答案 虽然不完美,但这就是我一直在做的事情. (希望其他人会跳进去改进它)

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)

点赞