All Projects → codebox → readable-regex

codebox / readable-regex

Licence: MIT license
Java library for creating readable regular expressions

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to readable-regex

Newspaper
Read webpages in readability mode, inside your terminal.
Stars: ✭ 168 (+600%)
Mutual labels:  readability
Simpread Little
简悦( SimpRead ) · 轻阅版
Stars: ✭ 216 (+800%)
Mutual labels:  readability
moar
Deterministic Regular Expressions with Backreferences
Stars: ✭ 19 (-20.83%)
Mutual labels:  regular-expressions
Article Parser
To extract main article from given URL with Node.js
Stars: ✭ 179 (+645.83%)
Mutual labels:  readability
Code Review Checklist
This code review checklist helps you be a more effective and efficient code reviewer.
Stars: ✭ 214 (+791.67%)
Mutual labels:  readability
stream-editor
A web tool for interactively using and chaining command-line text manipulation utilities like sed, grep, and awk.
Stars: ✭ 25 (+4.17%)
Mutual labels:  regular-expressions
Readability
visualise readability
Stars: ✭ 160 (+566.67%)
Mutual labels:  readability
Neural-Scam-Artist
Web Scraping, Document Deduplication & GPT-2 Fine-tuning with a newly created scam dataset.
Stars: ✭ 18 (-25%)
Mutual labels:  readability
Web Clipper
For Notion,OneNote,Bear,Yuque,Joplin。Clip anything to anywhere
Stars: ✭ 3,645 (+15087.5%)
Mutual labels:  readability
foxreplace
Replace text in webpages
Stars: ✭ 72 (+200%)
Mutual labels:  regular-expressions
Readability
Readability is Elixir library for extracting and curating articles.
Stars: ✭ 188 (+683.33%)
Mutual labels:  readability
Readabilitysax
a fast and platform independent readability port (JS)
Stars: ✭ 216 (+800%)
Mutual labels:  readability
PyEmailer
Send Emails In One Click With Python.
Stars: ✭ 29 (+20.83%)
Mutual labels:  regular-expressions
Cadmium
Natural Language Processing (NLP) library for Crystal
Stars: ✭ 172 (+616.67%)
Mutual labels:  readability
ChatControl-Pro
The ultimate chat solution. Prevent spam, ads, swears and even bots on your server. Replaced by ChatControl Red: https://mineacademy.org/chatcontrol-red
Stars: ✭ 65 (+170.83%)
Mutual labels:  regular-expressions
Reading List Mover
A Python utility for moving bookmarks/reading lists between services
Stars: ✭ 166 (+591.67%)
Mutual labels:  readability
Go Readability
Go package that cleans a HTML page for better readability.
Stars: ✭ 252 (+950%)
Mutual labels:  readability
Ruby Regexp
Learn Ruby Regexp step by step from beginner to advanced levels with plenty of examples and exercises
Stars: ✭ 79 (+229.17%)
Mutual labels:  regular-expressions
readability-cli
A CLI for Mozilla Readability. Get clean, uncluttered, ready-to-read HTML from any webpage!
Stars: ✭ 41 (+70.83%)
Mutual labels:  readability
readability
Fast readability scores for text data
Stars: ✭ 22 (-8.33%)
Mutual labels:  readability

Readable Regex

This library provides a way to make complex regular expressions in Java code more readable.

The best way to explain what it does to show some examples:

 // Matches a single digit
    RegExBuilder.build(anyDigit()); // "[0-9]"

 // Matches exactly 2 digits
    RegExBuilder.build(exactly(2).of(anyDigit())); // "[0-9]{2}"

 // Matches between 2 and 4 letters
    RegExBuilder.build(between(2,4).of(anyLetter())); // "[a-zA-Z]{2,4}"

Characters that have special meaning within a regular expression are escaped automatically:

 // Matches one or more occurrences of the text 'Ho?'
    RegExBuilder.build(oneOrMore().of("Ho?")); // "(Ho\?)+"
    
 // Matches anything except an opening or closing square bracket, or a backslash
    RegExBuilder.build(
        anyCharacterExcept(
            characters('[', ']','\\')
        )
    ); // "[^[\\]\\\\]"

Readability is greatly improved for more complex expressions:

 // More or less validates the format of an email address
 // [_\\-A-Za-z0-9]+(\\.[_\\-A-Za-z0-9]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*\\.[a-zA-Z]{2,}
    RegExBuilder.build(
        oneOrMore().of(
            anyOneOf(
                characters('_','-'), range('A','Z'), range('a','z'), range('0','9')
            )
        ),
        zeroOrMore().of(
            text("."),
            oneOrMore().of(
                anyOneOf(
                    characters('_','-'), range('A','Z'), range('a','z'), range('0','9')
                )
            )
        ),
        text("@"),
        oneOrMore().of(
            anyOneOf(
                range('A','Z'), range('a','z'), range('0','9')
            )
        ),
        zeroOrMore().of(
            text("."),
            oneOrMore().of(
                anyOneOf(
                    range('A','Z'), range('a','z'), range('0','9')
                )
            )
        ),
        text("."),
        atLeast(2).of(
            anyLetter()
        )
    );

All classes in the library are immutable, and therefore instances are re-usable and thread-safe.

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