bun
bun copied to clipboard
Certain regex pattern report as SyntaxError
What version of Bun is running?
0.2.1
What platform is your computer?
Darwin 21.6.0 Darwin Kernel Version 21.6.0: Mon Aug 22 20:19:52 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T6000 arm64 arm
What steps can reproduce the bug?
const regex_is_single_css_selector = /[^\\],(?!([^([]+[^\\]|[^([\\])[)\]])/;
How often does it reproduce? Is there a required condition?
with certain non-escaped charactor in regex pattern.
What is the expected behavior?
consider the above regex legal as in chrome / node / firefox does.
What do you see instead?
SyntaxError: Invalid regular expression: premature end of char-class
Additional information
No response
I'm getting an issue with regex too. For me it's caused by this module (no issues with this module from Node.js or Deno; something too strict in parsing?):
https://github.com/markdown-it/uc.micro/blob/master/properties/Any/regex.js
1 | __cJS2eSM
2 | } from "bun:wrap";
3 | export default __cJS2eSM(function(module, exports) {
4 |
5 | module.exports = (new globalThis.Bun.OnigurumaRegExp("[\\0-\\uD7FF\\uE000-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF]"));
^
SyntaxError: Invalid regular expression: too short multibyte code string
at /home/kelsey/projects/js/documents-web/node_modules/uc.micro/properties/Any/regex.js:1:15
at bun:wrap:1:16360
at /home/kelsey/projects/js/documents-web/node_modules/uc.micro/index.js:3:22
at bun:wrap:1:16360
at /home/kelsey/projects/js/documents-web/node_modules/markdown-it/lib/common/utils.js:300:38
at bun:wrap:1:16360
at /home/kelsey/projects/js/documents-web/node_modules/markdown-it/lib/index.js:6:27
at bun:wrap:1:16360
at /home/kelsey/projects/js/documents-web/node_modules/markdown-it/index.js:4:25
at bun:wrap:1:16360
at /home/kelsey/projects/js/documents-web/index.js:2:0
Bun version also 0.2.1.
My specific issue at least seems to be fixed now in Bun 0.2.2, I guess due to this:
https://github.com/oven-sh/bun/pull/1363
My specific issue at least seems to be fixed now in Bun 0.2.2, I guess due to this:
#1363
tested on v0.2.2 my problems are fixed.