23

Nodexr: A node-based Regular Expression editor

 3 years ago
source link: https://github.com/jcparkyn/nodexr/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Nodexr

Nodexr is a node-based Regular Expression editor, created in C# and Blazor. Nodexr is published here .

Currently it is based on the .NET Regex flavour, although there is potential to allow the user to easily switch between flavours while using the same nodes.

This screenshot shows a Regular Expression used to match floating point numbers, with or without an exponent: eIBbYnV.png!web

Features

  • Uses the full .NET Regex engine (unlike almost all other online Regex tools).
  • Show the results of search and replace (using the .NET Regex engine) in the browser in realtime.
  • Full syntax highlighting.
  • Hover over sections of the output to see which node they were generated by.
  • The nodes can be used to work with (almost) all of the .NET Regex spec, and any additional functionality can be implemented either by using the Text node without escaping, or with a custom Group node.
  • The node-based approach makes it almost impossible to have syntax errors, missing parentheses etc (except with certain nodes)
  • Enter an existing Regex and it will be parsed into a fully editable node tree (using the Edit button next to the output). This should work with expressions of any complexity level (although there are a couple of niche features that can't yet be parsed properly).
  • Create a shareable link for your expression, to send to someone else or come back to later (this feature currently relies on the expression parsing, so in some cases the node tree will be a little different after sharing - but the expression should be the same).
  • Information about each node can be found by clicking the (i) button next to its title.
  • Automatically deals with non-capturing groups, so you no longer have to think about them in 99% of cases.
  • Runs completely client-side - no communication with a server after the initial page load.

How To Use

Drag-and-drop nodes from the left panel to insert them into the main window. The final result/output of your nodes must be connected to the Output node and is displayed at the top left.

The main concept is that the "nesting" behaviour of regex is expressed by connecting one node to the input of another, but items in sequence are connected using the Previous input at the top left of each node. Expressions can alternatively be connected in sequence (concatenated) using the Concatenate node. The output expression will be empty unless one or more nodes are connected to the Output node.

Nodes

Information about each node can be found by clicking the (i) button next to its title.

To use any Regex functionality that cannot be implemented with the provided nodes, create a Text node with 'escape' disabled to input parts of the expression manually.

Replacement

Use the bottom 3 panels to test a string for searching and/or replacement. Any valid .NET Regex replacement string can be used here, including named and/or numbered group references. The bottom right panel shows the result after replacement.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK