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

Improve extractor for arbitrary values with quotes #4817

merged 1 commit into from Jun 26, 2021


Copy link

@adamwathan adamwathan commented Jun 26, 2021

Fixes #4801.

This PR improves our default extractor regex to handle arbitrary values that are wrapped in quotes more precisely.

Previously, given this input:

<h1 class="<?php echo wrap(['class' => 'max-w-[16rem]']); ?>">Hello world</h1>

...we would find a class named max-w-[16rem]']. This PR makes sure we find max-w-[16rem] instead, while preserving the ability to match things like content-['hello'] and even content-[']'].

We don't match this properly yet: content-['hello[]'], but we also didn't before this PR, so this is still purely an improvement over what was there before.

Since the regex is getting long, I've also broken it up into 4 parts with a few comments for each piece to explain what it's for.

@adamwathan adamwathan merged commit a6e79f9 into master Jun 26, 2021
3 checks passed
@adamwathan adamwathan deleted the fix-4801 branch Jun 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

1 participant