All Projects → mifmif → Generex

mifmif / Generex

A Java library for generating String from a regular expression.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Generex

pcre-net
PCRE.NET - Perl Compatible Regular Expressions for .NET
Stars: ✭ 114 (-63.92%)
Mutual labels:  regex, regular-expression
Rex
Your RegEx companion.
Stars: ✭ 283 (-10.44%)
Mutual labels:  regex, regular-expression
globrex
Glob to regular expression with support for extended globs.
Stars: ✭ 52 (-83.54%)
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 (-88.29%)
Mutual labels:  regex, regular-expression
genex
Genex package for Go
Stars: ✭ 64 (-79.75%)
Mutual labels:  regex, regular-expression
expand-brackets
Expand POSIX bracket expressions (character classes) in glob patterns.
Stars: ✭ 26 (-91.77%)
Mutual labels:  regex, regular-expression
RgxGen
Regex: generate matching and non matching strings based on regex pattern.
Stars: ✭ 45 (-85.76%)
Mutual labels:  regex, regular-expression
termco
Regular Expression Counts of Terms and Substrings
Stars: ✭ 24 (-92.41%)
Mutual labels:  regex, regular-expression
hex-color-regex
Regular expression for matching hex color values from string.
Stars: ✭ 29 (-90.82%)
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 (-87.66%)
Mutual labels:  regex, regular-expression
CVparser
CVparser is software for parsing or extracting data out of CV/resumes.
Stars: ✭ 28 (-91.14%)
Mutual labels:  regex, regular-expression
Regex
Regular expressions for swift
Stars: ✭ 306 (-3.16%)
Mutual labels:  regex, regular-expression
LLRegex
Regular expression library in Swift, wrapping NSRegularExpression.
Stars: ✭ 18 (-94.3%)
Mutual labels:  regex, regular-expression
Anymatch
‼️ Matches strings against configurable strings, globs, regular expressions, and/or functions
Stars: ✭ 289 (-8.54%)
Mutual labels:  regex, regular-expression
es6-template-regex
Regular expression for matching es6 template delimiters in a string.
Stars: ✭ 15 (-95.25%)
Mutual labels:  regex, regular-expression
cheat-sheet-pdf
📜 A Cheat-Sheet Collection from the WWW
Stars: ✭ 728 (+130.38%)
Mutual labels:  regex, regular-expression
Regex
🔤 Swifty regular expressions
Stars: ✭ 311 (-1.58%)
Mutual labels:  regex, regular-expression
regexp-expand
Show the ELisp regular expression at point in rx form.
Stars: ✭ 18 (-94.3%)
Mutual labels:  regex, regular-expression
pamatcher
A pattern matching library for JavaScript iterators
Stars: ✭ 23 (-92.72%)
Mutual labels:  regex, regular-expression
extglob
Extended globs. Add (almost) the expressive power of regular expressions to glob patterns.
Stars: ✭ 25 (-92.09%)
Mutual labels:  regex, regular-expression

Generex

A Java library for generating String that match a given regular expression. it help you generate all Strings that matches a given Regex, random one , or one String from the matched String based on it's index. Generex is based on the library http://www.brics.dk/~amoeller/automaton/.

Build Status

Features :

-Generate Random String that match the Regex.

-Specify the min/max length of the random generated String.

-Generate a list of all Strings that matches the Regex, if the number of String that matches the Regex is greater then Integer.MAX_VALUE , the returned list will contains Strings up to the size limit of java.util.List which is Integer.MAX_VALUE (see iterator's feature in this case).

-generate a sublist of the Strings that matches the Regex based on the lexicographical order.

-Given an index 'n' , generate the n'th element in lexicographical order of the list of Strings that matches the Regex.

-Prepare an iterator that loop over all the Strings that matches the Regex. even if the set of String that matches the given Regex is infinite.

How to use it :

If you use Maven you can include this library to your project by adding the following dependency:

<dependency>
  <groupId>com.github.mifmif</groupId>
  <artifactId>generex</artifactId>
  <version>1.0.2</version>
</dependency>

The list of all available versions can be found at Maven Central.

Here is the sample Java code demonstrating library usage:

		Generex generex = new Generex("[0-3]([a-c]|[e-g]{1,2})");

		// Generate random String
		String randomStr = generex.random();
		System.out.println(randomStr);// a random value from the previous String list

		// generate the second String in lexicographical order that match the given Regex.
		String secondString = generex.getMatchedString(2);
		System.out.println(secondString);// it print '0b'

		// Generate all String that matches the given Regex.
		List<String> matchedStrs = generex.getAllMatchedStrings();

		// Using Generex iterator
		Iterator iterator = generex.iterator();
		while (iterator.hasNext()) {
			System.out.print(iterator.next() + " ");
		}
		// it prints:
		// 0a 0b 0c 0e 0ee 0ef 0eg 0f 0fe 0ff 0fg 0g 0ge 0gf 0gg
		// 1a 1b 1c 1e 1ee 1ef 1eg 1f 1fe 1ff 1fg 1g 1ge 1gf 1gg
		// 2a 2b 2c 2e 2ee 2ef 2eg 2f 2fe 2ff 2fg 2g 2ge 2gf 2gg
		// 3a 3b 3c 3e 3ee 3ef 3eg 3f 3fe 3ff 3fg 3g 3ge 3gf 3gg
		

License

Generex is licensed under the Apache License, Version 2.0.
http://www.apache.org/licenses/LICENSE-2.0

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].