Skip to content

pxpeterxu/react-regexr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-regexr

react-regexr is an implementation of the excellent RegExr's interface in a reusable React component.

Usage

react-regexr exports two different React components:

  1. ExpressionEditor: this is the "Expression" top bar from regexr.com, which allows you to edit a regular expression with syntax highlighting and hover tooltips.

  2. SourceEditor: this is the "Text" field, which, when given the flags and an expression, will highlight the matches

Basic usage:

// CommonJS require
var ExpressionEditor = require('react-regexr').ExpressionEditor;
// or ES6 modules
import { ExpressionEditor } from 'react-regexr';

...
  render: function() {
    var { expression, text } = this.state;

    return (<div>
      <ExpressionEditor
        expression={expression}
        onChange={this.handleExpressionChange}
      />
      <SourceEditor
        expression={expression}
        text={text}
        onTextChange={this.handleTextChange}
      />
    </div>);
  }

About

A React wrapper for the Regex editor part of RegExr (http://www.regexr.com/)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published