{"id":13581012,"url":"https://github.com/CJex/regulex","last_synced_at":"2025-04-06T06:32:25.791Z","repository":{"id":16685534,"uuid":"19441793","full_name":"CJex/regulex","owner":"CJex","description":":construction: Regular Expression Excited!","archived":false,"fork":false,"pushed_at":"2022-07-12T09:37:03.000Z","size":417,"stargazers_count":5797,"open_issues_count":22,"forks_count":758,"subscribers_count":165,"default_branch":"master","last_synced_at":"2025-03-30T10:34:22.154Z","etag":null,"topics":["diagram","javascript","regex","regexp","regular-expression","regulex","typescript"],"latest_commit_sha":null,"homepage":"https://jex.im/regulex/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CJex.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-05-05T02:40:52.000Z","updated_at":"2025-03-28T18:22:34.000Z","dependencies_parsed_at":"2022-07-12T01:47:34.898Z","dependency_job_id":null,"html_url":"https://github.com/CJex/regulex","commit_stats":null,"previous_names":["jexcheng/regulex"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CJex%2Fregulex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CJex%2Fregulex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CJex%2Fregulex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CJex%2Fregulex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CJex","download_url":"https://codeload.github.com/CJex/regulex/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247445652,"owners_count":20939952,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["diagram","javascript","regex","regexp","regular-expression","regulex","typescript"],"created_at":"2024-08-01T15:01:57.262Z","updated_at":"2025-04-06T06:32:25.486Z","avatar_url":"https://github.com/CJex.png","language":"TypeScript","readme":"# Regulex\n\n[Regulex](https://jex.im/regulex/) is a JavaScript Regular Expression Parser \u0026 Visualizer.\n\nTry it now: \u003chttps://jex.im/regulex/\u003e\n\n**This project is under reconstruction!**\n\n### Features\n\n- Written in pure JavaScript. No backend required.\n- You can embed the graph on you own site through HTML iframe element.\n- Detailed error message. In most cases it can point out the precise syntax error position.\n- No support for octal escape. Yes it is a feature! ECMAScript strict mode doesn't allow octal escape in string, but many browsers still allow octal escape in regex. In regulex, DecimalEscape will always be treated as back reference. If the back reference is invalid, e.g. `/\\1/`, `/(\\1)/`, `/(a)\\2/`, or DecimalEscape appears in charset（because in this case it can't be explained as back reference, e.g. `/(ab)[\\1]/`, Regulex will always throw an error.\n\n### Install for Node.js\n```\nnpm install regulex\n```\n\n\n### Local Build for Browser\nThis command will generate bundle `dist/regulex.js` for browser side:\n```bash\ngit checkout legacy\nnpm install -g requirejs\nr.js -o build-config.js\n```\n\n### API\n\n#### Parse to AST\n\n```javascript\nvar parse = require(\"regulex\").parse;\nvar re = /var\\s+([a-zA-Z_]\\w*);/ ;\nconsole.log(parse(re.source));\n```\n\n#### Visualize\n\n```javascript\nvar parse = require(\"regulex\").parse;\nvar visualize = require(\"regulex\").visualize;\nvar Raphael = require('regulex').Raphael;\nvar re = /var\\s+([a-zA-Z_]\\w*);/;\nvar paper = Raphael(\"yourSvgContainerId\", 0, 0);\ntry {\n  visualize(parse(re.source), getRegexFlags(re), paper);\n} catch(e) {\n  if (e instanceof parse.RegexSyntaxError) {\n    logError(re, e);\n  } else {\n    throw e;\n  }\n}\n\nfunction logError(re, err) {\n  var msg = [\"Error:\" + err.message, \"\"];\n  if (typeof err.lastIndex === \"number\") {\n    msg.push(re);\n    msg.push(new Array(err.lastIndex).join(\"-\") + \"^\");\n  }\n  console.log(msg.join(\"\\n\"));\n}\n\n\nfunction getRegexFlags(re) {\n  var flags = \"\";\n  flags += re.ignoreCase ? \"i\" : \"\";\n  flags += re.global ? \"g\" : \"\";\n  flags += re.multiline ? \"m\" : \"\";\n  return flags;\n}\n```\n","funding_links":[],"categories":["TypeScript","javascript","Used by"],"sub_categories":["Open source projects (\u003e1k⭐)"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCJex%2Fregulex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCJex%2Fregulex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCJex%2Fregulex/lists"}