{"id":22294974,"url":"https://github.com/buscedv/abnormal-expressions","last_synced_at":"2025-03-25T22:22:11.662Z","repository":{"id":57407831,"uuid":"250252195","full_name":"Buscedv/abnormal-expressions","owner":"Buscedv","description":"Abnormal expressions (abnex) is an alternative to regular expressions (regex).","archived":false,"fork":false,"pushed_at":"2021-08-16T14:52:12.000Z","size":42,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-01T12:23:19.595Z","etag":null,"topics":["abnex","hacktoberfest","regex"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Buscedv.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":"2020-03-26T12:27:24.000Z","updated_at":"2021-10-10T19:40:01.000Z","dependencies_parsed_at":"2022-09-26T17:10:21.197Z","dependency_job_id":null,"html_url":"https://github.com/Buscedv/abnormal-expressions","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Buscedv%2Fabnormal-expressions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Buscedv%2Fabnormal-expressions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Buscedv%2Fabnormal-expressions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Buscedv%2Fabnormal-expressions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Buscedv","download_url":"https://codeload.github.com/Buscedv/abnormal-expressions/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245550922,"owners_count":20633941,"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":["abnex","hacktoberfest","regex"],"created_at":"2024-12-03T17:39:54.278Z","updated_at":"2025-03-25T22:22:11.641Z","avatar_url":"https://github.com/Buscedv.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Abnormal expressions\nAbnormal expressions (abnex) is an alternative to regular expressions (regex).\nThis is a Python library but the abnex syntax could be ported to other languages.\n\n# Examples\n## Matching an email address\n- Regex\n  - `([\\w\\._-]+)@([\\w\\.]+)`\n- Abnex\n  - `{[w\"._-\"]1++}\"@\"{[w\".\"]1++}`\n- Abnex (spaced)\n  - `{[w \"._-\"]1++} \"@\" {[w \".\"]1++}`\n\n- Abnex (expanded)\n  ```\n  {\n    [w \"._-\"]1++\n  }\n  \"@\"\n  {\n    [w \".\"]1++\n  }\n  ```\n  ## A more advanced pattern:\n  `{{{[a-z '_']1++} {[a-z 0-9 '_-.']0++}} '@' {{[a-z 0-9]1++} '.' {[a-z 0-9]1++} {[a-z 0-9 '-_.']0++}} {[a-z 0-9]1++}}`.\n\n# Why is Abnex Better?\n- It's easier to read, write and understand.\n- You can use spaces inside of the expression, you can also \"expand\" it, i.e. write it over multiple lines and use indention.\n- You don't have to use a backslashes all the time\n- More logical/common symbols like `!` for _not_, `{}` for _groups_, `1++`, `0++`, `0+` for: _one or more_, _zero or more_, _zero or one_.\n- It's easier to see if a symbol is an actual symbol you are searching for or if it's a regex character, ex:\n  - Regex: `[\\w-]+@[\\w-_]+`\n  - Abnex: `[w \"-\"]1++ \"@\" [w \"-\"]1++`\n\n# Documentation\n### Regex on right after -\u003e is the abnex equivalent\n## Anchors\n- Start of string, or start of line in multi-line pattern\n  - `^` -\u003e `-\u003e`\n- End of string, or end of line in multi-line pattern\n  - `$` -\u003e `\u003c-`\n- Start of string\n  - `\\A` -\u003e `s\u003e`\n- End of string\n  - `\\Z` -\u003e `\u003cs`\n- Word boundary\n  - `\\b` -\u003e `:`\n- Not word boundary\n  - `\\B` -\u003e `!:`\n- Start of word\n  - `\\\u003c` -\u003e `w\u003e`\n- End of word\n  - `\\\u003e` -\u003e `\u003cw`\n\n## Character Classes\n- Control character\n  - `\\c` -\u003e `c`\n- White space\n  - `\\s` -\u003e `_`\n- Not white space\n  - `\\S` -\u003e `!_`\n- Digit\n  - `\\d` -\u003e `d`\n- Not digit\n  - `\\D` -\u003e `!d`\n- Word\n  - `\\w` -\u003e `w`\n- Not word\n  - `\\W` -\u003e `!w`\n- Hexade­cimal digit\n  - `\\x` -\u003e `x`\n- Octal digit\n  - `\\o` -\u003e `o`\n\n## Quantifiers\n- 0 or more\n  - `*` -\u003e `0++`\n- 1 or more\n  - `+` -\u003e `1++`\n- 0 or 1\n  - `?` -\u003e `0+`\n\n## Groups and Ranges\n- Any character except new line (\\n)\n  - `.` -\u003e `*`\n- a or b\n  - `a|b` -\u003e `\"a\"|\"b\"`\n- Group\n  - `(...)` -\u003e `{...}`\n- Passive (non-c­apt­uring) group\n  - `(?:...)` -\u003e `{#...}`\n- Range (a or b or c)\n  - `[abc]` -\u003e `['abc']` or `[\"a\" \"b\" \"c\"]`\n- Not in set\n  - `[^...]` -\u003e `[!...]`\n- Lower case letter from a to Z\n  - `[a-q]` -\u003e `[a-z]`\n- Upper case letter from A to Q\n  - `[A-Q]` -\u003e `[A-Q]`\n- Digit from 0 to 7\n  - `[0-7]` -\u003e `[0-7]`\n\n# Standards\nWhat is the recommended way to write abnexes\n\n- Use spaces between characters in character sets:\n  - Correct: `[w \"_-\"]`\n  - Incorrect: `[w\"_-\"]`\n- Put multiple exact characters between the same quotes in character sets:\n  - Correct: `[\"abc\"]`\n  - Incorrect: `[\"a\" \"b\" \"c\"]`, especially incorrect: `[\"a\"\"b\"\"c\"]`\n- Put spaces between groups:\n  - Correct: `{w} \".\" {w}`\n  - Incorrect: `{w}\".\"{w}`\n\n### Examples:\nMatch for an email address:\n- Regex:\n  - `[\\w-\\._]+@[\\w-\\.]+`\n- Abnex (following standards):\n  - `{[w \"-._\"]1++} \"@\" {[w \"-.\"]1++}`\n- Abnex (not following standards):\n  - `{[w\"-._\"]1++}\"@\"{[w\"-.\"]1++}`\n  \n# Functions (In Python)\n__Abnex has most functions from the `re` library, but it also has som extra functionality like: `last()` \u0026 `contains()`.__\n\n## Common functions between re and abnex\n### Regex on right after -\u003e is the abnex equivalent\n- `match()` -\u003e `match()`\n- `findall()` -\u003e `all()`\n- `split()` -\u003e `split()`\n- `sub()` -\u003e `replace()`\n- `subn()` -\u003e `replace_count()`\n- `search()` -\u003e `first()`\n## Special to abnex\n- `holds()`: whether or not a string matches an expression (bool).\n- `contains()`: wheter or not a string contains a match (bool).\n- `last()`: the last match in a string.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuscedv%2Fabnormal-expressions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbuscedv%2Fabnormal-expressions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuscedv%2Fabnormal-expressions/lists"}