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
fix: clean string regexp #7871
fix: clean string regexp #7871
Conversation
This still needs to handle comments that are on the same line as a regexp: const foo = /'/ // this doesn't work result: const foo = this doesn't work |
thank again, fixed! https://regex101.com/r/9myfsm/1 |
It doesn't seem to work right when there's an escaped https://regex101.com/r/I3tD8q/1 The following seems to work better for me: "([^"]|(?<=\\)")*"|'([^']|(?<=\\)')*'|\/\*(.|[\r\n])*?\*\/|\/\/.*|\/.*?(?<!\\)\/ |
I found, hhh. And fixing now. |
Actually yours was just one character off, you had "([^"]|(?<=\\)")*"|'([^']|(?<=\\)')*'|\/\*(.|[\r\n])*?\*\/|\/\/.*|\/([^\/]|(?<=\\)\/)*\/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was able to verify that my site is now able to build with these changes, thank you 👍
https://regex101.com/r/Kk2cJ0/1 I think the best way is make the affect in one line. beacause we can't to process 1 / 1 + new URL('./hello.js', import.meta.url).href + 1 / 1 And I think an error match in one line (such as the below error) can accept. const a = /111'111/ // new URL('./hello.js', import.meta.url).href |
I was able to catch more cases by ignoring syntactically invalid quote characters. I think this is as good as we can make it without doing a separate initial pass that strips away comments. https://regex101.com/r/acTUGD/1 The opening quote character is ignored when the most recent non-whitespace character is a word character: Additionally, the closing quote character is ignored when the next non-whitespace character is a word character: |
Co-authored-by: patak <matias.capeletto@gmail.com>
Although it can narrow the scope of the problem, it still feels that it can not completely solve the problem. I want to solve this problem thoroughly through other methods. 🙈 |
@kherock if you interesting in this let talk in |
Description
fix: #7855
Additional context
make cleanString don't affect by regexp
https://regex101.com/r/G2SYip/1
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).