https://github.com/liulinboyi/regexp
JavaScript正则 JavaScript regexp 移植MuJS中的正则,使用JavaScript,来实现JavaScript中的正则,RegExp in JavaScript,方便大家使用自己熟悉的语言调试
https://github.com/liulinboyi/regexp
c javascript mujs regexp
Last synced: 2 months ago
JSON representation
JavaScript正则 JavaScript regexp 移植MuJS中的正则,使用JavaScript,来实现JavaScript中的正则,RegExp in JavaScript,方便大家使用自己熟悉的语言调试
- Host: GitHub
- URL: https://github.com/liulinboyi/regexp
- Owner: liulinboyi
- Created: 2021-11-28T08:07:49.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-11-29T05:49:45.000Z (over 4 years ago)
- Last Synced: 2025-11-03T06:25:19.645Z (8 months ago)
- Topics: c, javascript, mujs, regexp
- Language: C
- Homepage:
- Size: 20.5 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# JavaScript版正则(RegExp)实现
> 使用JavaScript,来实现JavaScript中的正则,RegExp in JavaScript,方便大家使用自己熟悉的语言调试
- 移植于[RegExp.c](./RegExp.c),大致上是[MuJS中的正则](https://github.com/ccxvii/mujs/blob/master/regexp.c),MuJS仓库后续有些许变动,不是特别大
- [原仓库](https://github.com/ccxvii/minilibs/blob/master/regexp.c)
- 移植过来的可能有Bug,我只测试了[RegExp.js](./RegExp.js)中的两个用例,其他未测试。
测试用例:
```
"/root/temp/hello.mp3".match(/.+\/(.+\..+)$/)
"noonday".match(/\B../)
"_foo0_(x,y)".match(/^([_a-zA-Z0-9]*)(?:\(.*\))/)
"_foo0_(x,y)".match(/^((?:[_a-zA-Z])+(?:[_a-zA-Z\d])*)(?:\((.*)\))?/)
"0_foo0_(x,y)".match(/^((?:[_a-zA-Z])+(?:[_a-zA-Z\d])*)(?:\((.*)\))?/) // no match
"_foo0_ (x,y)".match(/^((?:[_a-zA-Z])+(?:[_a-zA-Z\d])*)[ ]*(?:\((.*)\))?/)
```