Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

expgen

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expgen

  • 0.1.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Expgen

Expgen solves a very simple problem: Given a regular expression, find a string which matches that regular expression. Use it like this:

Expgen.gen(/foo\w+b[a-z]{2,3}/) # => "fooxbdp"

For a full list of supported syntax, see the spec file.

Some things are really difficult to generate accurate expressions for, it's even quite easy to create a regexp which matches no strings. For example /a\bc/ will not match any string, since there can never be a word boundary between characters.

When given a negative character class, Expgen takes the entire ASCII character set (sans control characters) and removes from it any characters excluded by the character class. In other words, if the character class excludes the entire ASCII character set, Expgen will be unable to fill this space.

The following is a list of things Expgen does not support:

  • Anchors (are ignored)
  • Lookaheads and lookbehinds
  • Subexpressions
  • Backreferences

Doesn't this already exist?

There is a gem called Randexp which does much the same thing. Expgen differs from Randexp in two important ways. (1) It actually works. (2) It supports a much wider range of regexp syntax.

The idea behind Expgen is that you should be able to take any reasonable, real world regular expression and be able to generate matching strings. The focus is on finding Strings which match a particular expression, not necessarily using it as a random generator.

License

MIT, see separate LICENSE.txt file

FAQs

Package last updated on 02 Apr 2013

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc