{"id":16758182,"url":"https://github.com/foo123/regexanalyzer","last_synced_at":"2026-03-10T00:33:31.602Z","repository":{"id":12279802,"uuid":"14903753","full_name":"foo123/RegexAnalyzer","owner":"foo123","description":"Regular Expression Analyzer and Composer for JavaScript, PHP, Python","archived":false,"fork":false,"pushed_at":"2025-12-02T10:12:43.000Z","size":616,"stargazers_count":92,"open_issues_count":1,"forks_count":12,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-05T06:38:41.436Z","etag":null,"topics":["analyser","browser","composer","javascript","php","python","regular-expression","statistics"],"latest_commit_sha":null,"homepage":"https://foo123.github.io/examples/regex-analyzer/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/foo123.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-12-03T19:40:13.000Z","updated_at":"2025-12-02T10:12:47.000Z","dependencies_parsed_at":"2023-01-13T16:52:18.184Z","dependency_job_id":null,"html_url":"https://github.com/foo123/RegexAnalyzer","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/foo123/RegexAnalyzer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo123%2FRegexAnalyzer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo123%2FRegexAnalyzer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo123%2FRegexAnalyzer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo123%2FRegexAnalyzer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/foo123","download_url":"https://codeload.github.com/foo123/RegexAnalyzer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo123%2FRegexAnalyzer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30318479,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T20:05:46.299Z","status":"ssl_error","status_checked_at":"2026-03-09T19:57:04.425Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["analyser","browser","composer","javascript","php","python","regular-expression","statistics"],"created_at":"2024-10-13T04:04:24.174Z","updated_at":"2026-03-10T00:33:31.587Z","avatar_url":"https://github.com/foo123.png","language":"JavaScript","readme":"Regex.Analyzer and Regex.Composer\r\n=================================\r\n\r\nA generic, simple \u0026amp; intuitive **Regular Expression Analyzer \u0026amp; Composer** for PHP, Python,  Javascript\r\n\r\n\r\n**Regex v.1.2.0** (js only)\r\n\r\n\r\nThese were used mostly as parts of other projects but uploaded here as standalone.\r\n\r\n\r\nSee `/test/js/test.js` under `/test` folder for examples of how to use\r\n\r\n\r\n**Regex.Analyzer Live Playground Example:**\r\n\r\n[![Live Playground Example](/test/screenshot.png)](https://foo123.github.com/examples/regex-analyzer/)\r\n\r\n\r\n**Regex.Composer Live Playground Example:**\r\n\r\n[![Live Playground Example](/test/screenshot2.png)](https://foo123.github.com/examples/regex-composer/)\r\n\r\n\r\n**Example:**  (see `/test/js/test.js`)\r\n\r\n```javascript\r\n//\r\n// use as: node test.js \"your_regex_here\" \u003e output.txt\r\n\"use strict\";\r\n\r\nvar echo = console.log;\r\n\r\n\r\nvar Regex = require('../../src/js/Regex.js');\r\n\r\necho(\"Regex.VERSION = \" + Regex.VERSION);\r\n\r\necho(\"Testing Regex.Composer\");\r\necho(\"===============================================================\");\r\n\r\nvar identifierSubRegex = Regex.Composer( )\r\n\r\n                .characterGroup( )\r\n                    .characters( '_' )\r\n                    .range( 'a', 'z' )\r\n                .end( )\r\n\r\n                .characterGroup( )\r\n                    .characters( '_' )\r\n                    .range( 'a', 'z' )\r\n                    .range( '0', '9' )\r\n                .end( ).zeroOrMore( )\r\n\r\n                .partial( );\r\n\r\nvar outregex = Regex.Composer( )\r\n\r\n                .SOL( )\r\n\r\n                .nonCaptureGroup( ).either( )\r\n                    .regexp( identifierSubRegex )\r\n                    .namedGroup( 'token' ).literal( '**aabb**' ).end( )\r\n                    .any( )\r\n                    .space( )\r\n                    .digit( false ).oneOrMore( )\r\n                .end( 2 ).zeroOrMore( false )\r\n\r\n                .backReference( 'token' )\r\n\r\n                .EOL( )\r\n\r\n                .compose( 'i' );\r\n\r\necho(\"Partial        : \" + identifierSubRegex);\r\necho(\"Composed       : \" + outregex.pattern.toString());\r\necho(\"Expected       : \" + \"/^(?:[_a-z][_a-z0-9]*|(\\\\*\\\\*aabb\\\\*\\\\*)|.|\\\\s|\\\\D+)*?\\\\1$/i\");\r\necho(\"Output         : \" + JSON.stringify(outregex, null, 4));\r\necho(\"===============================================================\");\r\necho();\r\n\r\nvar anal, peekChars, sampleStr, minLen, maxLen, groups, regexp,\r\n    inregex = \"/(?P\u003cnamed_group\u003e[abcde]+)fgh(?P=named_group)(?# a comment)/i\";\r\n\r\necho(\"Testing Regex.Analyzer\");\r\necho(\"===============================================================\");\r\n\r\n// test it\r\nanal = Regex.Analyzer( inregex );\r\npeekChars = anal.peek( );\r\nminLen = anal.minimum( );\r\nmaxLen = anal.maximum( );\r\nregexp = anal.compile( {i:anal.fl.i?1:0} );\r\nsampleStr = anal.sample( 1, 5 );\r\ngroups = anal.groups();\r\nfor(var i=0; i\u003c5; i++)\r\n{\r\n    var m = sampleStr[i].match(regexp);\r\n    sampleStr[i] = {sample:sampleStr[i], match:(m ? 'yes' : 'no'), groups: {}};\r\n    if ( m )\r\n    {\r\n        for(var g in groups)\r\n            if ( Object.prototype.hasOwnProperty.call(groups,g) )\r\n                sampleStr[i].groups[g] = m[groups[g]];\r\n    }\r\n}\r\n\r\necho(\"Input                                       : \" + inregex.toString( ));\r\necho(\"Regular Expression                          : \" + anal.input());\r\necho(\"Regular Expression Flags                    : \" + Object.keys(anal.fl).join(','));\r\necho(\"Reconstructed Regular Expression            : \" + anal.source());\r\necho(\"===============================================================\");\r\necho(\"Regular Expression Syntax Tree              : \");\r\necho(JSON.stringify(anal.tree(true), null, 4));\r\necho(\"===============================================================\");\r\necho(\"Regular Expression (Named) Matched Groups   : \");\r\necho(JSON.stringify(groups, null, 4));\r\necho(\"===============================================================\");\r\necho(\"Regular Expression Peek Characters          : \");\r\necho(JSON.stringify({positive:Object.keys(peekChars.positive||{}),negative:Object.keys(peekChars.negative||{})}, null, 4));\r\necho(\"===============================================================\");\r\necho(\"Regular Expression Minimum / Maximum Length : \");\r\necho(JSON.stringify({minimum:minLen,maximum:-1===maxLen?'unlimited':maxLen}, null, 4));\r\necho(\"===============================================================\");\r\necho(\"Regular Expression Sample Match Strings     : \");\r\necho(JSON.stringify(sampleStr, null, 4));\r\necho(\"===============================================================\");\r\n```\r\n\r\n**Result**\r\n\r\n```text\r\nRegex.VERSION = 1.0.0\r\nTesting Regex.Composer\r\n===============================================================\r\nPartial        : [_a-z][_a-z0-9]*\r\nComposed       : /^(?:[_a-z][_a-z0-9]*|(\\*\\*aabb\\*\\*)|.|\\s|\\D+)*?\\1$/i\r\nExpected       : /^(?:[_a-z][_a-z0-9]*|(\\*\\*aabb\\*\\*)|.|\\s|\\D+)*?\\1$/i\r\nOutput         : {\r\n    \"source\": \"^(?:[_a-z][_a-z0-9]*|(\\\\*\\\\*aabb\\\\*\\\\*)|.|\\\\s|\\\\D+)*?\\\\1$\",\r\n    \"flags\": \"i\",\r\n    \"groups\": {\r\n        \"1\": 1,\r\n        \"token\": 1\r\n    },\r\n    \"pattern\": {}\r\n}\r\n===============================================================\r\n\r\nTesting Regex.Analyzer\r\n===============================================================\r\nInput                                       : /(?P\u003cnamed_group\u003e[abcde]+)fgh(?P=named_group)(?# a comment)/i\r\nRegular Expression                          : (?P\u003cnamed_group\u003e[abcde]+)fgh(?P=named_group)(?# a comment)\r\nRegular Expression Flags                    : i\r\nReconstructed Regular Expression            : ([abcde]+)fgh\\1\r\n===============================================================\r\nRegular Expression Syntax Tree              :\r\n{\r\n    \"type\": \"Sequence\",\r\n    \"value\": [\r\n        {\r\n            \"type\": \"Group\",\r\n            \"value\": {\r\n                \"type\": \"Sequence\",\r\n                \"value\": [\r\n                    {\r\n                        \"type\": \"Quantifier\",\r\n                        \"value\": {\r\n                            \"type\": \"CharacterGroup\",\r\n                            \"value\": [\r\n                                {\r\n                                    \"type\": \"Characters\",\r\n                                    \"value\": [\r\n                                        \"a\",\r\n                                        \"b\",\r\n                                        \"c\",\r\n                                        \"d\",\r\n                                        \"e\"\r\n                                    ]\r\n                                }\r\n                            ]\r\n                        },\r\n                        \"flags\": {\r\n                            \"MatchOneOrMore\": 1,\r\n                            \"min\": 1,\r\n                            \"max\": -1,\r\n                            \"isGreedy\": 1\r\n                        }\r\n                    }\r\n                ]\r\n            },\r\n            \"flags\": {\r\n                \"NamedGroup\": 1,\r\n                \"GroupName\": \"named_group\",\r\n                \"GroupIndex\": 1\r\n            }\r\n        },\r\n        {\r\n            \"type\": \"String\",\r\n            \"value\": \"fgh\"\r\n        },\r\n        {\r\n            \"type\": \"Special\",\r\n            \"value\": \"1\",\r\n            \"flags\": {\r\n                \"BackReference\": 1,\r\n                \"GroupName\": \"named_group\",\r\n                \"GroupIndex\": 1\r\n            }\r\n        },\r\n        {\r\n            \"type\": \"Comment\",\r\n            \"value\": \" a comment\"\r\n        }\r\n    ]\r\n}\r\n===============================================================\r\nRegular Expression (Named) Matched Groups   :\r\n{\r\n    \"1\": 1,\r\n    \"named_group\": 1\r\n}\r\n===============================================================\r\nRegular Expression Peek Characters          :\r\n{\r\n    \"positive\": [\r\n        \"a\",\r\n        \"b\",\r\n        \"c\",\r\n        \"d\",\r\n        \"e\",\r\n        \"A\",\r\n        \"B\",\r\n        \"C\",\r\n        \"D\",\r\n        \"E\"\r\n    ],\r\n    \"negative\": []\r\n}\r\n===============================================================\r\nRegular Expression Minimum / Maximum Length :\r\n{\r\n    \"minimum\": 5,\r\n    \"maximum\": \"unlimited\"\r\n}\r\n===============================================================\r\nRegular Expression Sample Match Strings     :\r\n[\r\n    {\r\n        \"sample\": \"AdbFGHAdb\",\r\n        \"match\": \"yes\",\r\n        \"groups\": {\r\n            \"1\": \"Adb\",\r\n            \"named_group\": \"Adb\"\r\n        }\r\n    },\r\n    {\r\n        \"sample\": \"CDfghCD\",\r\n        \"match\": \"yes\",\r\n        \"groups\": {\r\n            \"1\": \"CD\",\r\n            \"named_group\": \"CD\"\r\n        }\r\n    },\r\n    {\r\n        \"sample\": \"CBCfghCBC\",\r\n        \"match\": \"yes\",\r\n        \"groups\": {\r\n            \"1\": \"CBC\",\r\n            \"named_group\": \"CBC\"\r\n        }\r\n    },\r\n    {\r\n        \"sample\": \"BbaAFGHBbaA\",\r\n        \"match\": \"yes\",\r\n        \"groups\": {\r\n            \"1\": \"BbaA\",\r\n            \"named_group\": \"BbaA\"\r\n        }\r\n    },\r\n    {\r\n        \"sample\": \"EfghE\",\r\n        \"match\": \"yes\",\r\n        \"groups\": {\r\n            \"1\": \"E\",\r\n            \"named_group\": \"E\"\r\n        }\r\n    }\r\n]\r\n===============================================================\r\n```\r\n\r\n**see also:**\r\n\r\n* [Abacus](https://github.com/foo123/Abacus) Computer Algebra and Symbolic Computation System for Combinatorics and Algebraic Number Theory for JavaScript and Python\r\n* [SciLite](https://github.com/foo123/SciLite) Scientific Computing Environment similar to Octave/Matlab in pure JavaScript\r\n* [TensorView](https://github.com/foo123/TensorView) view array data as multidimensional tensors of various shapes efficiently\r\n* [FILTER.js](https://github.com/foo123/FILTER.js) video and image processing and computer vision Library in pure JavaScript (browser and nodejs)\r\n* [HAAR.js](https://github.com/foo123/HAAR.js) image feature detection based on Haar Cascades in JavaScript (Viola-Jones-Lienhart et al Algorithm)\r\n* [HAARPHP](https://github.com/foo123/HAARPHP) image feature detection based on Haar Cascades in PHP (Viola-Jones-Lienhart et al Algorithm)\r\n* [Fuzzion](https://github.com/foo123/Fuzzion) a library of fuzzy / approximate string metrics for PHP, JavaScript, Python\r\n* [Matchy](https://github.com/foo123/Matchy) a library of string matching algorithms for PHP, JavaScript, Python\r\n* [Regex Analyzer/Composer](https://github.com/foo123/RegexAnalyzer) Regular Expression Analyzer and Composer for PHP, JavaScript, Python\r\n* [Xpresion](https://github.com/foo123/Xpresion) a simple and flexible eXpression parser engine (with custom functions and variables support), based on [GrammarTemplate](https://github.com/foo123/GrammarTemplate), for PHP, JavaScript, Python\r\n* [GrammarTemplate](https://github.com/foo123/GrammarTemplate) grammar-based templating for PHP, JavaScript, Python\r\n* [codemirror-grammar](https://github.com/foo123/codemirror-grammar) transform a formal grammar in JSON format into a syntax-highlight parser for CodeMirror editor\r\n* [ace-grammar](https://github.com/foo123/ace-grammar) transform a formal grammar in JSON format into a syntax-highlight parser for ACE editor\r\n* [prism-grammar](https://github.com/foo123/prism-grammar) transform a formal grammar in JSON format into a syntax-highlighter for Prism code highlighter\r\n* [highlightjs-grammar](https://github.com/foo123/highlightjs-grammar) transform a formal grammar in JSON format into a syntax-highlight mode for Highlight.js code highlighter\r\n* [syntaxhighlighter-grammar](https://github.com/foo123/syntaxhighlighter-grammar) transform a formal grammar in JSON format to a highlight brush for SyntaxHighlighter code highlighter\r\n* [MOD3](https://github.com/foo123/MOD3) 3D Modifier Library in JavaScript\r\n* [Geometrize](https://github.com/foo123/Geometrize) Computational Geometry and Rendering Library for JavaScript\r\n* [Plot.js](https://github.com/foo123/Plot.js) simple and small library which can plot graphs of functions and various simple charts and can render to Canvas, SVG and plain HTML\r\n* [CanvasLite](https://github.com/foo123/CanvasLite) an html canvas implementation in pure JavaScript\r\n* [Rasterizer](https://github.com/foo123/Rasterizer) stroke and fill lines, rectangles, curves and paths, without canvas\r\n* [Gradient](https://github.com/foo123/Gradient) create linear, radial, conic and elliptic gradients and image patterns without canvas\r\n* [css-color](https://github.com/foo123/css-color) simple class to parse and manipulate colors in various formats\r\n* [PatternMatchingAlgorithms](https://github.com/foo123/PatternMatchingAlgorithms) library of Pattern Matching Algorithms in JavaScript using [Matchy](https://github.com/foo123/Matchy)\r\n* [SortingAlgorithms](https://github.com/foo123/SortingAlgorithms) library of Sorting Algorithms in JavaScript\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoo123%2Fregexanalyzer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffoo123%2Fregexanalyzer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoo123%2Fregexanalyzer/lists"}