Skip to content

Commit

Permalink
improve regex
Browse files Browse the repository at this point in the history
  • Loading branch information
rish-0-0 committed Dec 4, 2024
1 parent 95450b8 commit d299b02
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { MarkerType } from "@xyflow/react";
import { Neo4jNode, Neo4jResponse } from "./NeoFlowViz";

// Regex to match only nodes with defined variable names and optional types
export const nodeRegex = /\((\w+):?(\w+)?(?:\s*\{[^\}]*\})?\)/g;
// Regex to match only relationships with defined variable names and optional types
export const relationshipRegex = /\[(\w+):?(\w+)?(?:\s*\{[^\}]*\})?\]/g;
// Regex for nodes and relationships
export const nodeRegex = /\((\w+)?(:\w+)?(?:\s*\{[^\}]*\})?\)/g;
export const relationshipRegex = /\[(\w+)?(:[^\]]+)?(?:\s*\{[^\}]*\})?\]/g;

function getResourceMappingFromQuery(query: string): { [key: string]: string } {
let match: RegExpExecArray | null;
Expand Down

0 comments on commit d299b02

Please sign in to comment.