Skip to content
This repository was archived by the owner on Jul 4, 2023. It is now read-only.

SyntaxError: invalid regexp group #5

Closed
michelcve opened this issue Dec 24, 2019 · 4 comments
Closed

SyntaxError: invalid regexp group #5

michelcve opened this issue Dec 24, 2019 · 4 comments

Comments

@michelcve
Copy link

When I install your addon, I get the following error in the console: "SyntaxError: invalid regexp group"

Same thing happens with our own demo: http://bestof.morganatwork.com/storybook-addon-xd-designs/

@emiliemarchand
Copy link

This is due to lookbehind assertions in the following regexes. It is an ES2018 feature, which is not yet supported by Firefox.

// lib/register/components/XD.js
const parseReviewUrl = (url) => url && url.match(/https:\/\/xd.adobe.com\/view\/(?<reviewId>[0-9a-zA-Z-]{22,128})/);
const parseSpecUrl = (url) => url && url.match(/https:\/\/xd.adobe.com\/spec\/(?<specId>[0-9a-zA-Z-]{22,128})\/screen\/(?<screenId>[0-9a-zA-Z-]{22,128})\/(?<artboard>[^\/]*)\/?$/);

@morgs32
Copy link
Owner

morgs32 commented Mar 23, 2020

Where's the lookbehind? Might it be that the browser just doesn't support named capture groups? I'll remove them anyhow. @michelcve sorry for not getting to this long ago.

@emiliemarchand
Copy link

@morgs32 My bad, I saw the (?< pattern and assumed it was a lookbehind but you're right it's a named capture group. It's also an ES2018 feature so it causes the same error.

morgs32 added a commit that referenced this issue Mar 31, 2020
@morgs32
Copy link
Owner

morgs32 commented Mar 31, 2020

Fixed in 5.4.0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants