All Projects → alixaxel → genex

alixaxel / genex

Licence: MIT License
Genex package for Go

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to genex

regexp-expand
Show the ELisp regular expression at point in rx form.
Stars: ✭ 18 (-71.87%)
Mutual labels:  regex, regular-expression
LLRegex
Regular expression library in Swift, wrapping NSRegularExpression.
Stars: ✭ 18 (-71.87%)
Mutual labels:  regex, regular-expression
termco
Regular Expression Counts of Terms and Substrings
Stars: ✭ 24 (-62.5%)
Mutual labels:  regex, regular-expression
regex-cache
Memoize the results of a call to the RegExp constructor, avoiding repetitious runtime compilation of the same string and options, resulting in dramatic speed improvements.
Stars: ✭ 39 (-39.06%)
Mutual labels:  regex, regular-expression
globrex
Glob to regular expression with support for extended globs.
Stars: ✭ 52 (-18.75%)
Mutual labels:  regex, regular-expression
cregex
A small implementation of regular expression matching engine in C
Stars: ✭ 72 (+12.5%)
Mutual labels:  regex, regular-expression
RgxGen
Regex: generate matching and non matching strings based on regex pattern.
Stars: ✭ 45 (-29.69%)
Mutual labels:  regex, regular-expression
pcre-heavy
A Haskell regular expressions library that doesn't suck | now on https://codeberg.org/valpackett/pcre-heavy
Stars: ✭ 52 (-18.75%)
Mutual labels:  regex, regular-expression
expand-brackets
Expand POSIX bracket expressions (character classes) in glob patterns.
Stars: ✭ 26 (-59.37%)
Mutual labels:  regex, regular-expression
dregex
Dregex is a JVM library that implements a regular expression engine using deterministic finite automata (DFA). It supports some Perl-style features and yet retains linear matching time, and also offers set operations.
Stars: ✭ 37 (-42.19%)
Mutual labels:  regex, regular-expression
regex
Regular expressions for Prolog
Stars: ✭ 16 (-75%)
Mutual labels:  regex, regular-expression
pamatcher
A pattern matching library for JavaScript iterators
Stars: ✭ 23 (-64.06%)
Mutual labels:  regex, regular-expression
RegexReplacer
A flexible tool to make complex replacements with regular expression
Stars: ✭ 38 (-40.62%)
Mutual labels:  regex, regular-expression
Regex
🔤 Swifty regular expressions
Stars: ✭ 311 (+385.94%)
Mutual labels:  regex, regular-expression
doi-regex
Regular expression for matching DOIs
Stars: ✭ 28 (-56.25%)
Mutual labels:  regex, regular-expression
es6-template-regex
Regular expression for matching es6 template delimiters in a string.
Stars: ✭ 15 (-76.56%)
Mutual labels:  regex, regular-expression
compiler-design-lab
These are my programs for compiler design lab work in my sixth semester
Stars: ✭ 47 (-26.56%)
Mutual labels:  regex, regular-expression
regex-not
Create a javascript regular expression for matching everything except for the given string.
Stars: ✭ 31 (-51.56%)
Mutual labels:  regex, regular-expression
CVparser
CVparser is software for parsing or extracting data out of CV/resumes.
Stars: ✭ 28 (-56.25%)
Mutual labels:  regex, regular-expression
cheat-sheet-pdf
📜 A Cheat-Sheet Collection from the WWW
Stars: ✭ 728 (+1037.5%)
Mutual labels:  regex, regular-expression

genex GoDoc GoCover Go Report Card

Genex package for Go

Easy and efficient package to expand any given regex into all the possible strings that it can match.

This is the code that powers namegrep.

Usage

package main

import (
    "fmt"
    "regexp/syntax"

    "github.com/alixaxel/genex"
)

func main() {
    charset, _ := syntax.Parse(`[0-9a-z]`, syntax.Perl)

    if input, err := syntax.Parse(`(foo|bar|baz){1,2}\d`, syntax.Perl); err == nil {
    	fmt.Println("Count:", genex.Count(input, charset, 3))

    	genex.Generate(input, charset, 3, func(output string) {
    		fmt.Println("[*]", output)
    	})
    }
}

Output

Count: 120

[*] foo0
[*] ...
[*] foo9
[*] foofoo0
[*] ...
[*] foofoo9
[*] foobar0
[*] ...
[*] foobar9
[*] foobaz0
[*] ...
[*] foobaz9
[*] bar0
[*] ...
[*] bar9
[*] barfoo0
[*] ...
[*] barfoo9
[*] barbar0
[*] ...
[*] barbar9
[*] barbaz0
[*] ...
[*] barbaz9
[*] baz0
[*] ...
[*] baz9
[*] bazfoo0
[*] ...
[*] bazfoo9
[*] bazbar0
[*] ...
[*] bazbar9
[*] bazbaz0
[*] ...
[*] bazbaz9

Install

go get github.com/alixaxel/genex

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].