2016-09-22 4 views

Antwort

1

zwar nicht perfekt, hier ist, was ich zu tun ist. (Hoffentlich andere springen in und verbessern)

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)

Verwandte Themen