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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify RegExp of WebGLState.js #20897

Merged
merged 1 commit into from Dec 17, 2020

Conversation

gonnavis
Copy link
Contributor

Related issue: -

Description

Why escape space? It is the same in my tests.
In addition, Replace [0-9] with \d, which I think is more beautiful馃槃 and can reduce the file size a little bit.
Maybe a little bit more performance? I'm not sure.

@Mugen87
Copy link
Collaborator

Mugen87 commented Dec 17, 2020

Refactoring is fine but there is always a certain amount of risk for breakage. I hope you are really confident about these regex changes...

Maybe a little bit more performance?

I don't think that matters at this place.

@gonnavis
Copy link
Contributor Author

gonnavis commented Dec 17, 2020

I'm very confident about the substitution of [0-9] to \d.

\d: Matches any digit (Arabic numeral). Equivalent to [0-9]. For example, /\d/ or /[0-9]/ matches "2" in "B2 is the suite number".

Regarding the escape of spaces, is this the case?

Note that some characters like :, -, @, etc. neither have a special meaning when escaped nor when unescaped. Escape sequences like :, -, @ will be equivalent to their literal, unescaped character equivalents in regular expressions.

I did not find any results related to the escape of spaces after searching. I think it should belong to the above situation.
Therefore, with the successful results of auto-checks, I think they are the same.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Cheatsheet

@mrdoob
Copy link
Owner

mrdoob commented Dec 17, 2020

which I think is more beautiful馃槃

I like beautiful 馃榾

@mrdoob mrdoob added this to the r124 milestone Dec 17, 2020
@mrdoob
Copy link
Owner

mrdoob commented Dec 17, 2020

I think these changes seem safe.

@mrdoob mrdoob merged commit fdf9407 into mrdoob:dev Dec 17, 2020
@mrdoob
Copy link
Owner

mrdoob commented Dec 17, 2020

Thanks!

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

Successfully merging this pull request may close these issues.

None yet

3 participants