Skip to content

Conversation

@SeokminHong
Copy link
Contributor

Motivation

When I use a HTML elements containing regex's special characters(\, $, and so on) for class, extractClassesFromHtml function fails to parse them.

Summary

extractClassesFromHtml returns a regex array for matching class, thus I added escape characters(\) before the special characters.

Test plan

Try to parse the HTML document having class containing following characters for its class:

\, ^, $, {, }, [, ], (, ), ., *, +, ?, |

For example: <code class="language-C++">

* The `extractClassesFromHtml` function can fail to parse the some HTMLs because they have class names including special characters for regular expression.
@callstack-bot
Copy link

callstack-bot commented Jul 18, 2020

Hey @SeokminHong, thank you for your pull request 🤗.
The coverage report for this branch can be viewed here.

@iamakulov
Copy link

Just stumbled upon the same error! Would love to see this merged. How can I help?

@Anber Anber merged commit 7c322a4 into callstack:master Sep 3, 2020
Anber pushed a commit that referenced this pull request Sep 3, 2020
* fix: push '\' into className before regex special characters

* The `extractClassesFromHtml` function can fail to parse the some HTMLs because they have class names including special characters for regular expression.
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.

4 participants