Giter Site home page Giter Site logo

rg-software / regexworkbench Goto Github PK

View Code? Open in Web Editor NEW

This project forked from stephen-riley/regexworkbench

0.0 0.0 0.0 606 KB

A Visual Studio Code extension that allows one to easily play with regular expressions

JavaScript 32.10% TypeScript 51.35% CSS 16.55%

regexworkbench's Introduction

Preview

demo

Just click the regex star at the bottom right to get started.

click the star

Description

A regular expression workbench for Visual Studio Code in the style of Komodo's. Just click on the slash-star-slash icon in the lower right.

Currently supports match, match all, split, replace, and replace all.

How does it work?

The workbench uses the PCRE2 (Perl Compatible Regular Expressions) library, compiled to WebAssembly. See @stephen-riley/pcre2-wasm for that project. PCRE2 is a significant upgrade compared to the current Javascript RegExp functionality (though there is hope!).

Some important things to note about PCRE2 as used in this extension:

  • This PCRE2 is compiled with UTF-16 LE character units under the hood, so you should have no problem with Unicode characters.
  • It does not support Python replacement group references; eg. "\1 \2". You must use "$1 $2". \1 is still supported as a backreference in regular expression patterns; eg. ((?i)rah)\s+\1.
  • Named capture groups are supported in three syntaxes: (?<name>...), (?'name'...), and (?P<name>...).
  • You can use named capture groups in the replacement text with the syntax ${name}.

Why the delay in loading this extension?

At the time of writing, the V8 Javascript engine running Visual Studio Code always runs WebAssembly modules through its TurboFan optimizing compiler. PCRE2 has some seriously nontrivial logic in it that TurboFan takes 6-7 seconds to process. You will therefore notice a similar delay between launching vscode and seeing the Regular Expression Workbench icon appearing in the lower right. See this repo for further information.

Sideloading from a local build

If you want to run a customized version, here's how to sideload your own build.

Make sure you have Node.js installed, then run:

npm install -g vsce

Clone the repo and cd into its directory, then run:

vsce package

code --install-extension regexworkbench-<version>.vsix

(The version comes from package.json.)

regexworkbench's People

Contributors

dependabot[bot] avatar stephen-riley avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.