GithubHelp home page GithubHelp logo

regex-utilities's Introduction

regex-utilities

build status npm bundle size

Tiny utilities shared by the regex library and its extensions. Useful for parsing and processing regular expressions, when you don't need a full regex AST builder.

Constants

Context

Frozen object with the following properties for tracking regex syntax context:

  • DEFAULT - Base context.
  • CHAR_CLASS - Character class context.

Functions

See documentation in the source code for more details.

execUnescaped

Return a match object for the first unescaped version of a pattern in the given context, or null.

hasUnescaped

Check whether an unescaped version of a pattern appears in the given context.

forEachUnescaped

Run a callback on each unescaped version of a pattern in the given context.

replaceUnescaped

Replaces the given pattern only when it's unescaped and in the given context.

getGroupContents

Given a regex pattern and start position (just after the group's opening delimiter), return the contents of the group, accounting for escaped characters, nested groups, and character classes. Returns the rest of the string if the group is unclosed.

regex-utilities's People

Contributors

slevithan avatar

Stargazers

 avatar

Watchers

 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.