Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regex works in Node.js but not in Bun #17970

Open
SamyPesse opened this issue Mar 7, 2025 · 2 comments
Open

Regex works in Node.js but not in Bun #17970

SamyPesse opened this issue Mar 7, 2025 · 2 comments
Labels
bug Something isn't working confirmed bug We can reproduce this issue jsc Something related to JavaScriptCore node.js Compatibility with Node.js APIs regression

Comments

@SamyPesse
Copy link

What version of Bun is running?

1.2.4+fd9a5ea66

What platform is your computer?

Darwin 24.3.0 arm64 arm

What steps can reproduce the bug?

Run the following code using node and bun, you can observe that Node.js returns a result for the regex, while in bun, it logs null:

(async () => {
    const res = await fetch('https://raw.githubusercontent.com/GitbookIO/integrations/c26e594ca86bc75eaa18c4cda995dab56e21008a/integrations/arcade/assets/arcade-preview.png');
    const content = await res.arrayBuffer();
    const base64 = Buffer.from(content).toString('base64');

    const byteRegexp = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;

    console.log(base64.match(byteRegexp));
})()

This regex might not be correct, but it should still return the same value.

What is the expected behavior?

Both Node.js and Bun should return the same results.

What do you see instead?

Bun returns null.

Additional information

No response

@SamyPesse SamyPesse added bug Something isn't working needs triage labels Mar 7, 2025
@RiskyMH RiskyMH added node.js Compatibility with Node.js APIs confirmed bug We can reproduce this issue jsc Something related to JavaScriptCore regression and removed needs triage labels Mar 7, 2025
@RiskyMH
Copy link
Member

RiskyMH commented Mar 7, 2025

regressed in bun v1.2.3, likely JSC issue

@Jarred-Sumner
Copy link
Collaborator

Tracking this in https://bugs.webkit.org/show_bug.cgi?id=289330

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working confirmed bug We can reproduce this issue jsc Something related to JavaScriptCore node.js Compatibility with Node.js APIs regression
Projects
None yet
Development

No branches or pull requests

3 participants