All Projects → foo123 → Regexanalyzer

foo123 / Regexanalyzer

Regular Expression Analyzer and Composer for Node.js / XPCOM / Browser Javascript, PHP, Python

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Regexanalyzer

Debug
A tiny JavaScript debugging utility modelled after Node.js core's debugging technique. Works in Node.js and web browsers
Stars: ✭ 9,912 (+34079.31%)
Mutual labels:  node-js, browser
Rexrex
🦖 Composable JavaScript regular expressions
Stars: ✭ 34 (+17.24%)
Mutual labels:  composer, regular-expression
Asciichart
Nice-looking lightweight console ASCII line charts ╭┈╯ for NodeJS, browsers and terminal, no dependencies
Stars: ✭ 1,107 (+3717.24%)
Mutual labels:  node-js, browser
Rpg
Online Role Playing Game (based on Laravel)
Stars: ✭ 121 (+317.24%)
Mutual labels:  composer, browser
Stdlib
✨ Standard library for JavaScript and Node.js. ✨
Stars: ✭ 2,749 (+9379.31%)
Mutual labels:  statistics, node-js
Librmath.js
Javascript Pure Implementation of Statistical R "core" numerical libRmath.so
Stars: ✭ 425 (+1365.52%)
Mutual labels:  statistics, node-js
Otpauth
One Time Password (HOTP/TOTP) library for Node.js, Deno and browsers.
Stars: ✭ 135 (+365.52%)
Mutual labels:  node-js, browser
Srl Php
Simple Regex Language
Stars: ✭ 1,808 (+6134.48%)
Mutual labels:  composer, regular-expression
Laravel Stats
📈 Get insights about your Laravel or Lumen Project
Stars: ✭ 1,386 (+4679.31%)
Mutual labels:  statistics, composer
Filter.js
Filter.js: Video and Image Processing and Computer Vision Library in pure JavaScript (Browser and Node.js)
Stars: ✭ 335 (+1055.17%)
Mutual labels:  node-js, browser
Phpuseragent
Lightning Fast, Minimalist PHP User Agent String Parser.
Stars: ✭ 451 (+1455.17%)
Mutual labels:  composer, browser
Awesome Mad Science
Delightful npm packages that make you say "wow, didn't know that was possible!"
Stars: ✭ 909 (+3034.48%)
Mutual labels:  browser
Caprover
Scalable PaaS (automated Docker+nginx) - aka Heroku on Steroids
Stars: ✭ 7,964 (+27362.07%)
Mutual labels:  node-js
Zhima
芝麻信用商家服务PHP版SDK。目前为止,是github上最好用的php版SDK
Stars: ✭ 13 (-55.17%)
Mutual labels:  composer
Brave Ios
Brave iOS Browser
Stars: ✭ 871 (+2903.45%)
Mutual labels:  browser
Census Data Aggregator
Combine U.S. census data responsibly
Stars: ✭ 28 (-3.45%)
Mutual labels:  statistics
Regex
A sane interface for php's built in preg_* functions
Stars: ✭ 909 (+3034.48%)
Mutual labels:  regular-expression
Hotcold
Smart touch typing learning with instant key glow indications, live statistics, live graphs and dynamic course creation.
Stars: ✭ 12 (-58.62%)
Mutual labels:  statistics
Azure Sdk For Js
This repository is for active development of the Azure SDK for JavaScript (NodeJS & Browser). For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/en-us/javascript/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-js.
Stars: ✭ 872 (+2906.9%)
Mutual labels:  browser
Xhgui Branch
uprofiler UI,xhprof UI,tideways UI , PHP Non-intrusive performance monitoring platform.
Stars: ✭ 872 (+2906.9%)
Mutual labels:  composer

Regex.Analyzer and Regex.Composer

A generic, simple & intuitive Regular Expression Analyzer & Composer for PHP, Python, Node.js / Browser / XPCOM Javascript

Regex v.1.1.0

see also:

  • Contemplate a light-weight template engine for Node.js / Browser / XPCOM Javascript, PHP, Python
  • Tao A simple, tiny, isomorphic, precise and fast template engine for handling both string and live dom based templates
  • ModelView a light-weight and flexible MVVM framework for JavaScript/HTML5
  • ModelView MVC jQueryUI Widgets plug-n-play, state-full, full-MVC widgets for jQueryUI using modelview.js (e.g calendars, datepickers, colorpickers, tables/grids, etc..) (in progress)
  • Dromeo a flexible, agnostic router for Node.js / Browser / XPCOM Javascript, PHP, Python
  • PublishSubscribe a simple and flexible publish-subscribe pattern implementation for Node.js / Browser / XPCOM Javascript, PHP, Python
  • GrammarTemplate versatile and intuitive grammar-based templating for Node.js / Browser / XPCOM Javascript, PHP, Python
  • Xpresion a simple and flexible eXpression parser engine (with custom functions and variables support) for Node.js / Browser / XPCOM Javascript, PHP, Python
  • Dialect an intuitive and versatile cross-platform & cross-vendor SQL query builder for Node.js / Browser / XPCOM Javascript, PHP, Python
  • Simulacra a simulation, algebraic, probability and combinatorics PHP package for scientific computations
  • RT client-side real-time communication for Node.js / Browser / XPCOM Javascript with support for Poll / BOSH / WebSockets
  • Asynchronous a simple manager for async, linearised, parallelised, interleaved and sequential tasks for JavaScript

These were used mostly as parts of other projects but uploaded here as standalone.

See /test/js/test.js under /test folder for examples of how to use

Regex.Analyzer Live Playground Example:

Live Playground Example

Regex.Composer Live Playground Example:

Live Playground Example

Example: (see /test/js/test.js)

//
// use as: node test.js "your_regex_here" > output.txt
"use strict";

var echo = console.log;


var Regex = require('../../src/js/Regex.js');

echo("Regex.VERSION = " + Regex.VERSION);

echo("Testing Regex.Composer");
echo("===============================================================");

var identifierSubRegex = Regex.Composer( )
                
                .characterGroup( )
                    .characters( '_' )
                    .range( 'a', 'z' )
                .end( )
                
                .characterGroup( )
                    .characters( '_' )
                    .range( 'a', 'z' )
                    .range( '0', '9' )
                .end( ).zeroOrMore( )
            
                .partial( );

var outregex = Regex.Composer( )
                    
                .SOL( )
                
                .nonCaptureGroup( ).either( )
                    .regexp( identifierSubRegex )
                    .namedGroup( 'token' ).literal( '**aabb**' ).end( )
                    .any( )
                    .space( )
                    .digit( false ).oneOrMore( )
                .end( 2 ).zeroOrMore( false )
                
                .backReference( 'token' )
                
                .EOL( )
                
                .compose( 'i' );
    
echo("Partial        : " + identifierSubRegex);
echo("Composed       : " + outregex.pattern.toString());
echo("Expected       : " + "/^(?:[_a-z][_a-z0-9]*|(\\*\\*aabb\\*\\*)|.|\\s|\\D+)*?\\1$/i");
echo("Output         : " + JSON.stringify(outregex, null, 4));
echo("===============================================================");
echo();

var anal, peekChars, sampleStr, minLen, maxLen, groups, regexp,
    inregex = "/(?P<named_group>[abcde]+)fgh(?P=named_group)(?# a comment)/i";

echo("Testing Regex.Analyzer");
echo("===============================================================");

// test it
anal = Regex.Analyzer( inregex );
peekChars = anal.peek( );
minLen = anal.minimum( );
maxLen = anal.maximum( );
regexp = anal.compile( {i:anal.fl.i?1:0} );
sampleStr = anal.sample( 1, 5 );
groups = anal.groups();
for(var i=0; i<5; i++)
{
    var m = sampleStr[i].match(regexp);
    sampleStr[i] = {sample:sampleStr[i], match:(m ? 'yes' : 'no'), groups: {}};
    if ( m )
    {
        for(var g in groups)
            if ( Object.prototype.hasOwnProperty.call(groups,g) )
                sampleStr[i].groups[g] = m[groups[g]];
    }
}

echo("Input                                       : " + inregex.toString( ));
echo("Regular Expression                          : " + anal.input());
echo("Regular Expression Flags                    : " + Object.keys(anal.fl).join(','));
echo("Reconstructed Regular Expression            : " + anal.source());
echo("===============================================================");
echo("Regular Expression Syntax Tree              : ");
echo(JSON.stringify(anal.tree(true), null, 4));
echo("===============================================================");
echo("Regular Expression (Named) Matched Groups   : ");
echo(JSON.stringify(groups, null, 4));
echo("===============================================================");
echo("Regular Expression Peek Characters          : ");
echo(JSON.stringify({positive:Object.keys(peekChars.positive||{}),negative:Object.keys(peekChars.negative||{})}, null, 4));
echo("===============================================================");
echo("Regular Expression Minimum / Maximum Length : ");
echo(JSON.stringify({minimum:minLen,maximum:-1===maxLen?'unlimited':maxLen}, null, 4));
echo("===============================================================");
echo("Regular Expression Sample Match Strings     : ");
echo(JSON.stringify(sampleStr, null, 4));
echo("===============================================================");

Result

Regex.VERSION = 1.0.0
Testing Regex.Composer
===============================================================
Partial        : [_a-z][_a-z0-9]*
Composed       : /^(?:[_a-z][_a-z0-9]*|(\*\*aabb\*\*)|.|\s|\D+)*?\1$/i
Expected       : /^(?:[_a-z][_a-z0-9]*|(\*\*aabb\*\*)|.|\s|\D+)*?\1$/i
Output         : {
    "source": "^(?:[_a-z][_a-z0-9]*|(\\*\\*aabb\\*\\*)|.|\\s|\\D+)*?\\1$",
    "flags": "i",
    "groups": {
        "1": 1,
        "token": 1
    },
    "pattern": {}
}
===============================================================

Testing Regex.Analyzer
===============================================================
Input                                       : /(?P<named_group>[abcde]+)fgh(?P=named_group)(?# a comment)/i
Regular Expression                          : (?P<named_group>[abcde]+)fgh(?P=named_group)(?# a comment)
Regular Expression Flags                    : i
Reconstructed Regular Expression            : ([abcde]+)fgh\1
===============================================================
Regular Expression Syntax Tree              : 
{
    "type": "Sequence",
    "value": [
        {
            "type": "Group",
            "value": {
                "type": "Sequence",
                "value": [
                    {
                        "type": "Quantifier",
                        "value": {
                            "type": "CharacterGroup",
                            "value": [
                                {
                                    "type": "Characters",
                                    "value": [
                                        "a",
                                        "b",
                                        "c",
                                        "d",
                                        "e"
                                    ]
                                }
                            ]
                        },
                        "flags": {
                            "MatchOneOrMore": 1,
                            "min": 1,
                            "max": -1,
                            "isGreedy": 1
                        }
                    }
                ]
            },
            "flags": {
                "NamedGroup": 1,
                "GroupName": "named_group",
                "GroupIndex": 1
            }
        },
        {
            "type": "String",
            "value": "fgh"
        },
        {
            "type": "Special",
            "value": "1",
            "flags": {
                "BackReference": 1,
                "GroupName": "named_group",
                "GroupIndex": 1
            }
        },
        {
            "type": "Comment",
            "value": " a comment"
        }
    ]
}
===============================================================
Regular Expression (Named) Matched Groups   : 
{
    "1": 1,
    "named_group": 1
}
===============================================================
Regular Expression Peek Characters          : 
{
    "positive": [
        "a",
        "b",
        "c",
        "d",
        "e",
        "A",
        "B",
        "C",
        "D",
        "E"
    ],
    "negative": []
}
===============================================================
Regular Expression Minimum / Maximum Length : 
{
    "minimum": 5,
    "maximum": "unlimited"
}
===============================================================
Regular Expression Sample Match Strings     : 
[
    {
        "sample": "AdbFGHAdb",
        "match": "yes",
        "groups": {
            "1": "Adb",
            "named_group": "Adb"
        }
    },
    {
        "sample": "CDfghCD",
        "match": "yes",
        "groups": {
            "1": "CD",
            "named_group": "CD"
        }
    },
    {
        "sample": "CBCfghCBC",
        "match": "yes",
        "groups": {
            "1": "CBC",
            "named_group": "CBC"
        }
    },
    {
        "sample": "BbaAFGHBbaA",
        "match": "yes",
        "groups": {
            "1": "BbaA",
            "named_group": "BbaA"
        }
    },
    {
        "sample": "EfghE",
        "match": "yes",
        "groups": {
            "1": "E",
            "named_group": "E"
        }
    }
]
===============================================================
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].