All Projects → ColinEberhardt → assemblyscript-regex

ColinEberhardt / assemblyscript-regex

Licence: MIT license
A regex engine for AssemblyScript

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to assemblyscript-regex

zig-regex
A regex implementation for the zig programming language
Stars: ✭ 60 (-25.93%)
Mutual labels:  regex, regex-engine
Regex
An implementation of regular expressions for Rust. This implementation uses finite automata and guarantees linear time matching on all inputs.
Stars: ✭ 2,125 (+2523.46%)
Mutual labels:  regex, regex-engine
moar
Deterministic Regular Expressions with Backreferences
Stars: ✭ 19 (-76.54%)
Mutual labels:  regex, regex-engine
parse-github-url
Parse a Github URL into an object. Supports a wide variety of GitHub URL formats.
Stars: ✭ 114 (+40.74%)
Mutual labels:  regex
blurhash-as
Blurhash implementation in AssemblyScript
Stars: ✭ 26 (-67.9%)
Mutual labels:  assemblyscript
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 (-19.75%)
Mutual labels:  regex
netease-music-cracker
🎵 缓存文件转换为 MP3 文件
Stars: ✭ 406 (+401.23%)
Mutual labels:  regex
ethereum-regex
Ξ Regular expression for matching Ethereum (ETH) addresses.
Stars: ✭ 19 (-76.54%)
Mutual labels:  regex
compiler-design-lab
These are my programs for compiler design lab work in my sixth semester
Stars: ✭ 47 (-41.98%)
Mutual labels:  regex
FileRenamerDiff
A File Renamer App featuring a difference display before and after the change.
Stars: ✭ 32 (-60.49%)
Mutual labels:  regex
lua-patterns
Lua Patterns Viewer. A tool for inspecting, analyzing and learning Lua patterns.
Stars: ✭ 71 (-12.35%)
Mutual labels:  regex
regex-comuns
Um estudo de regex comuns
Stars: ✭ 15 (-81.48%)
Mutual labels:  regex
learn-regex
Learn regex the easy way
Stars: ✭ 43,660 (+53801.23%)
Mutual labels:  regex
it-tools
A programing helper for developers built with Electron & Vue.js 🚀
Stars: ✭ 114 (+40.74%)
Mutual labels:  regex
FileDetectionRuleSets
🔎 Rules to detect game engines and other technologies based on Steam depot file lists
Stars: ✭ 106 (+30.86%)
Mutual labels:  regex
ChromaTerm
Color your Terminal with RegEx!
Stars: ✭ 149 (+83.95%)
Mutual labels:  regex
Regaxor
A regular expression fuzzer.
Stars: ✭ 35 (-56.79%)
Mutual labels:  regex
BinFind
Perform regex pattern matching on binary data. (Regex-like)
Stars: ✭ 31 (-61.73%)
Mutual labels:  regex
IncredibleTextAdventure
No description or website provided.
Stars: ✭ 19 (-76.54%)
Mutual labels:  regex
examples
A collection of AssemblyScript examples.
Stars: ✭ 233 (+187.65%)
Mutual labels:  assemblyscript

assemblyscript-regex

A regex engine for AssemblyScript.

AssemblyScript is a new language, based on TypeScript, that runs on WebAssembly. AssemblyScript has a lightweight standard library, but lacks support for Regular Expression. The project fills that gap!

This project exposes an API that mirrors the JavaScript RegExp class:

const regex = new RegExp("fo*", "g");
const str = "table football, foul";

let match: Match | null = regex.exec(str);
while (match != null) {
  // first iteration
  //   match.index = 6
  //   match.matches[0] = "foo"

  // second iteration
  //   match.index = 16
  //   match.matches[0] = "fo"
  match = regex.exec(str);
}

Project status

The initial focus of this implementation has been feature support and functionality over performance. It currently supports a sufficient number of regex features to be considered useful, including most character classes, common assertions, groups, alternations, capturing groups and quantifiers.

The next phase of development will focussed on more extensive testing and performance. The project currently has reasonable unit test coverage, focussed on positive and negative test cases on a per-feature basis. It also includes a more exhaustive test suite with test cases borrowed from another regex library.

Feature support

Based on the classfication within the MDN cheatsheet

Character sets

  • .
  • \d
  • \D
  • \w
  • \W
  • \s
  • \S
  • \t
  • \r
  • \n
  • \v
  • \f
  • [\b]
  • \0
  • \cX
  • \xhh
  • \uhhhh
  • \u{hhhh} or \u{hhhhh}
  • \

Assertions

  • ^
  • $
  • \b
  • \B

Other assertions

  • x(?=y) Lookahead assertion
  • x(?!y) Negative lookahead assertion
  • (?<=y)x Lookbehind assertion
  • (?<!y)x Negative lookbehind assertion

Groups and ranges

  • x|y
  • [xyz][a-c]
  • [^xyz][^a-c]
  • (x) capturing group
  • \n back reference
  • (?x) named capturing group
  • (?:x) Non-capturing group

Quantifiers

  • x*
  • x+
  • x?
  • x{n}
  • x{n,}
  • x{n,m}
  • x*? / x+? / ...

RegExp

  • global
  • sticky
  • case insensitive
  • multiline
  • dotAll
  • unicode

Development

This project is open source, MIT licenced and your contributions are very much welcomed.

To get started, check out the repository and install dependencies:

$ npm install

A few general points about the tools and processes this project uses:

  • This project uses prettier for code formatting and eslint to provide additional syntactic checks. These are both run on npm test and as part of the CI build.
  • The unit tests are executed using as-pect - a native AssemblyScript test runner
  • The specification tests are within the spec folder. The npm run test:generate target transforms these tests into as-pect tests which execute as part of the standard build / test cycle
  • In order to support improved debugging you can execute this library as TypeScript (rather than WebAssembly), via the npm run tsrun target.
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].