Implement new Concept Exercise: Regular Expressions
See original GitHub issueGetting Started
If you have not yet contributed to concept exercises before, this task requires some upfront reading to acquire the necessary background knowledge.
Here you can read about what Concept Exercises are and how they are structured:
If you have not done so yet, it is probably also helpful to do a couple of “Learning Exercises” (this is how they are called on the site) yourself. You can also look at the code of an existing concept exercise like bird-watcher
(concept for-loops
) for reference.
See the documentation above (general documentation), as well as How to implement a Concept Exercise in JavaScript.
Also be aware of these general guidelines.
Goal
The goal here is to create a new concept exercise to teach regular expressions. The concept needs to be written from scratch, the exercise can be ported from another track (see details below).
Concepts
The following concept needs to be created. You can use the introduction.md
file of the concept also as introduction.md
file of the exercise. No need to create different content at this point. Additionally, if you want to save some time it is ok to not have an extensive about.md
for now. It can also be mainly the introduction.md
content, maybe with some additions you would like to make.
regular-expressions
Learning Objectives
In the concepts the student should learn about the following topics and then practice them in the concept exercise.
- which flavor of regex is used in JavaScript and any notable differences to other common implementations
- how to create a regular expression
- how to pass flags in both versions of creating a regular expression
- how to use the most common regex related functions, with special focus on
- when to use test and when to use match
- understanding the different parts of the match result incl. capture results
- using e.g. https://regex101.com/ to help with writing/reading regex
- being aware of performance implications
Out of Scope
Explaining how to write regular expressions themselves is out of scope for the concept here but we should link to some good resource a student could read to learn about them from scratch, maybe Eloquent JavaScript for example. We don’t do this as part of the concept because Exercism assumes the student is already fluent in another language and most languages include some form of regular expressions.
Prerequisites
arrays
as this is the result of match etc.classes
to understand thenew Regex
syntax
Exercise Idea
C# “Parsing Log Lines” Exercise could serve as template.
In case you port that exercise, make sure to check all tasks make sense for JavaScript and whether some additional task needs to be added to cover some JavaScript specific content.
Resources
Here some links that might be helpful as a starting point and/or for the links section of the concept:
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Cheatsheet
- https://javascript.info/regular-expressions
- https://eloquentjavascript.net/09_regexp.html
How to proceed
- First accept this issue by saying “I’d like to work on this” (no need to wait for a response, just go ahead).
- Use this issue to discuss any questions you have, what should be included in the content and what not and to collect more reference material.
- Create a PR and set “exercism/javascript” as reviewers. Additionally you can write in #maintaining-javascript on Slack that your PR is ready for review. Once you incorporated any critical feedback that the reviewer might give you and the PR is approved, it will be merged by a maintainer.
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (9 by maintainers)
Yes, the best way is you push your changes and create a draft PR. Then leave a comment there which part I should look at.
Thanks a lot @junedev for the opportunity and clarification.
Then I’ll work on the concept, focusing on how JavaScript differs in writing regex. I think I got it, I’ll start thinking about the best approach as soon as possible.
Keep you updated.