Giter Club home page Giter Club logo

regex-generator's Introduction

Regex Generator Build and publish project

Regex Generator is a tool to generate simple regular expressions. The goal is that people with less experience can create regex smoothly.

Regex Generator tries to help you create a first version of a regular expression to recognize certain texts. It is designed to create regular expressions by putting together well-known snippets. This can be used as a starting point for regular expressions.

Hopefully nobody will need to use substring() anymore.

Usage

Online

Just go to Regex Generator and try it online.

The page supports several search parameters to change the initial state of the options:

  • sampleText changes the initial sample text of the regex generator
  • flags changes the flags used to generate the language snippets. Any combination of the following characters are allowed:
    • i case insensitive
    • s dot matches line breaks
    • m multiline
  • onlyPatterns this controls the "Generate only patterns" check box
  • matchWholeLine this controls the "Match whole line" check box
  • selection controls the matches that have been selected by the user

Example: https://regex-generator.olafneumann.org/?sampleText=Some%20text...&flags=im&onlyPatterns=false&matchWholeLine=true&selection=5%7CMultiple%20characters

Docker

You can also start it via docker. Just use the following command and find Regex Generator on port 80 of your local machine:

docker run -d -p 80:80 noxone/regexgenerator

Of course the docker version supports the same search parameters as the actual website.

Development

Build

  1. Clone the project

  2. In the project's root directory execute

    gradlew clean build

    Or use docker to build the project:

    docker build . -t noxone/regexgenerator
  3. Find the output in directory ./build/distributions/

Live Development

For a nice development experience use

gradlew run --continuous

Using this command the page will reload automatically for every source file change.

Reports

Unit Tests

Well, we don't have enough unit tests. But there are a few. See the results.

Detekt

Detekt is a code style checker for Kotlin. It is integrated in the build process to keep the code clean.

You can find the Detekt report for this project here.

Project goal

As written in the introduction the aim of the project is to enable everybody to use regular expressions. The use of substring() is nearly always unnecessary and if code is written in a reasonable manner you won't need that method.

There are a lot of very nice tools to build, understand and even debug your regex. Regex Generator tries to add a little bit to these tools to give you at least a starting point how the regex you need might look like.

Hopefully this regex generator continues to grow to eventually support a really wide range of functions and regular expressions.

Languages

The regex generator is currently able to generate code snippets in the following languages:

  • C (using regex.h)
  • C#
  • grep (command line tool)
  • Java
  • JavaScript
  • Kotlin
  • PHP
  • Python
  • Ruby
  • Swift
  • Visual Basic .NET

If you miss a language, just open a new issue or if you like, program the corresponding generator and open a pull request.

Patterns

At the moment there are 28 patterns of different complexity integrated in regex generator. It is able to recognize simple repetitions and combinations of multiple patterns.

In the final stage this Regex Generator shall support a wide range of use cases. Feel free to suggest new patterns via the issues.

More ideas

More ideas for new features or how to improve the application are very welcome. Please add them to the Github issues.

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.