Socket
Socket
Sign inDemoInstall

regex-colorize

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    regex-colorize

Highlighter for JavaScript regex syntax


Version published
Weekly downloads
333
increased by150.38%
Maintainers
1
Install size
59.1 kB
Created
Weekly downloads
 

Readme

Source

Regex Colorize

Color highlight your regex

Demo

See Slevithan's demo page

📦 Getting Started

npm

npm install regex-colorize --save

yarn

yarn add regex-colorize 

Install

npm

import RegexColorize from 'regex-colorize';
import 'regex-colorize/themes/default.css' // If you import a css file in your library

var rgx = new RegexColorize();

rgx.colorizeAll();
...

self-host/cdn

<link href="https://unpkg.com/regex-colorize/themes/default.css" rel="stylesheet">

<script src="//unpkg.com/regex-colorize"></script>

var RegexColorize = window.RegexColorize.default;

var rgx = new RegexColorize(); 
// rgx.addStyleSheet();
rgx.colorizeAll();
...

Usage


var rgx = new RegexColorize();
//new RegexColorize('my-regex'); to customize class names
//note that themes won't work with different class names, so edit the css files as well

// Don't run this line if you provide your own stylesheet
rgx.addStyleSheet();

// Can provide a class name for elements to process (defaults to class 'regex')
rgx.colorizeAll();
<code class="regex">/^[A-Za-z0-9]+(?:[ _-][A-Za-z0-9]+)*$/</code>

Themes

  • default.css
  • nobg.css
  • regexbuddy.css
  • regexpal.css
  • sweetest.css (NEW)

Credits

The code is extracted from Regex Colorizer by slevithan

Keywords

FAQs

Last updated on 05 Aug 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc