-
-
Notifications
You must be signed in to change notification settings - Fork 35.9k
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: Match single quotes #17539
Fix: Match single quotes #17539
Conversation
@Vimal-Raghubir updated the pull request. |
I am not sure how this styling is causing the linter to fail since it works on every regex checker I've used. Could a reviewer advise on this? |
@Vimal-Raghubir, thank you for taking on this issue, too! Regex is a little tricky, with some things needing to be double escaped for it to pass the linter. I'll take a look at it later when I have my laptop in front of me. Leaving this here so we can simplify your regex a little bit:
|
Hi @Vimal-Raghubir, sorry for the delay. I think I figured out how to refine both tests. Currently the challenge can be passed so long as "information about batteries" is wrapped in the Also, your test wasn't passing because of the way some characters need to be escaped in the test string. You're right, your regex works in regex checkers, but the problem was that you could have mismatching single and double quotes and still pass the check. Could you change the tests to the following?
|
I figured the mismatching quotes wouldn't have been handled by my regex expression. Interesting, didn't know you could use the OR operator within the regex expression. Will make the recommended changes. Thank you for your amazing support @scissorsneedfoodtoo . 👍 |
@Vimal-Raghubir updated the pull request. |
👍 👍 Everything LGTM! 👍 👍 Thank you for making those changes so quickly, and I'm always happy to look at your PRs. I also didn't know about the OR operator in regex and had to do some digging. I'm still not so good with it, so I'm glad we could figure out something that works. Looking forward to your next contribution! |
This reverts commit c0b47ae.
* Fix: Match single quotes * Fix: slash direction * Fix: Regex expression and refined tests
Pre-Submission Checklist
staging
branch of freeCodeCamp.fix/
,feature/
, ortranslate/
(e.g.fix/signin-issue
)npm test
. Usegit commit --amend
to amend any fixes.Type of Change
Checklist:
Closes #17508
Description
The
<a href>
attribute was hard coded to check only for double quoted URLs which does not cover the single quoted URLs. After checking the documentation, single quoted URLs are supported by these tags therefore I updated the regex expression to handle them as well.