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

Implement new Concept Exercise: Regular Expressions #2037

Closed
Tracked by #1886
junedev opened this issue Dec 28, 2021 · 4 comments · Fixed by #2159
Closed
Tracked by #1886

Implement new Concept Exercise: Regular Expressions #2037

junedev opened this issue Dec 28, 2021 · 4 comments · Fixed by #2159
Assignees
Labels
help wanted x:action/create Work on something from scratch x:knowledge/intermediate Quite a bit of Exercism knowledge required x:module/concept-exercise Work on Concept Exercises x:rep/large Large amount of reputation x:size/large Large amount of work x:status/claimed Someone is working on this issue x:type/content Work on content (e.g. exercises, concepts)

Comments

@junedev
Copy link
Member

junedev commented Dec 28, 2021

Getting 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 welcome-to-tech-palace for reference.

Also be aware of these general guidelines.

Goal

The goal here is to create a new concept exercise to teach how to use regular expressions in Go. 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 syntax is used in Go and its performance
  • limitations of regex in Go (see "Caveats" section here: https://swtch.com/~rsc/regexp/regexp3.html)
  • how to create a regular expression with Compile/MustCompile and when to use which
  • how to use the most common regex related functions (maybe what is mentioned here https://gobyexample.com/regular-expressions is a good starting point)
    • understanding difference between MatchX and FindX
    • understanding that there are byte and string versions of the functions
  • understanding the different parts of the Submatch results
  • how to set flags
  • using e.g. https://regex101.com/ to help with writing/reading regex

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. 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

  • runes so the student understand the string vs bytes distinction
  • slices to understand the result of FindX etc
  • methods because most functionality is provided by methods defined for the RegExp type

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 Go and whether some additional task needs to be added to cover some Go specific content.

Resources

Here some links that might be helpful as a starting point and/or for the links section of the concept:

How to proceed

  1. Accept this issue by saying "I'd like to work on this" (no need to wait for a response, just go with it).
  2. Use this issue to discuss any questions you have.
  3. Create a PR and set "exercism/go" as reviewers when you are done. Additionally you can write in #maintaining-go 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.
@junedev junedev added help wanted x:action/create Work on something from scratch x:knowledge/intermediate Quite a bit of Exercism knowledge required x:module/concept-exercise Work on Concept Exercises x:type/content Work on content (e.g. exercises, concepts) x:size/large Large amount of work labels Dec 28, 2021
@norbs57
Copy link
Contributor

norbs57 commented Apr 4, 2022

I would be happy to have a go at implementing a basic version including a concept exercise.

@andrerfcsantos andrerfcsantos added the x:status/claimed Someone is working on this issue label Apr 4, 2022
norbs57 added a commit to norbs57/go that referenced this issue Apr 6, 2022
Fixes exercism#2037
* Regular expression concept (basic version)
* Concept exercise

The first four tasks in the concept exercise are based on tasks in the corresponding C# exercise.
norbs57 added a commit to norbs57/go that referenced this issue Apr 6, 2022
Fixes exercism#2037
* Regular expression concept (basic version)
* Concept exercise

The first four tasks in the concept exercise are based on tasks in the corresponding C# exercise.
norbs57 added a commit to norbs57/go that referenced this issue Apr 6, 2022
Fixes exercism#2037
* Regular expression concept (basic version)
* Concept exercise

The first four tasks in the concept exercise are based on tasks in the corresponding C# exercise.
norbs57 added a commit to norbs57/go that referenced this issue Apr 7, 2022
Fixes exercism#2037
* Concept: regular expressions (in Go)
* Concept exercise

The first four tasks in the concept exercise are based on tasks in the corresponding C# exercise.
norbs57 added a commit to norbs57/go that referenced this issue Apr 7, 2022
Fixes exercism#2037
* Concept: regular expressions (in Go)
* Concept exercise

The first four tasks in the concept exercise are based on tasks in the corresponding C# exercise.
norbs57 added a commit to norbs57/go that referenced this issue Apr 7, 2022
Fixes exercism#2037
* Concept: regular expressions (in Go)
* Concept exercise

The first four tasks in the concept exercise are based on tasks in the corresponding C# exercise.
norbs57 added a commit to norbs57/go that referenced this issue Apr 7, 2022
Fixes exercism#2037
* Concept: regular expressions (in Go)
* Concept exercise

The first four tasks in the concept exercise are based on tasks in the corresponding C# exercise.
norbs57 added a commit to norbs57/go that referenced this issue Apr 7, 2022
Fixes exercism#2037
* Concept: regular expressions (in Go)
* Concept exercise

The first four tasks in the concept exercise are based on tasks in the corresponding C# exercise.
norbs57 added a commit to norbs57/go that referenced this issue Apr 7, 2022
Fixes exercism#2037
* Concept: regular expressions (in Go)
* Concept exercise

The first four tasks in the concept exercise are based on tasks in the corresponding C# exercise.
norbs57 added a commit to norbs57/go that referenced this issue Apr 7, 2022
Fixes exercism#2037
* Concept: regular expressions (in Go)
* Concept exercise

The first four tasks in the concept exercise are based on tasks in the corresponding C# exercise.
@junedev
Copy link
Member Author

junedev commented Apr 12, 2022

@norbs57 You wrote on Slack that you didn't cover all parts of what was described in this issue. If that was the case in the end, please create another issue that states what is currently missing (would probably be good to include a link to this issue as well).

@norbs57
Copy link
Contributor

norbs57 commented Apr 21, 2022

Current coverage of Learning Objectives:

  • which flavor of regex syntax is used in Go and its performance
    => No details given, only link
  • limitations of regex in Go (see "Caveats" section here: https://swtch.com/~rsc/regexp/regexp3.html)
    => No details given, only link
  • how to create a regular expression with Compile/MustCompile and when to use which
    => Done
  • how to use the most common regex related functions (maybe what is mentioned here https://gobyexample.com/regular-expressions is a good starting point)
    => Overview given as well as an explanation of five core functions with examples
  • understanding difference between MatchX and FindX
    => Explained functions MatchString and FindString and included examples
  • understanding that there are byte and string versions of the functions
    => Mentioned in overview
  • understanding the different parts of the Submatch results
    => Explained function FindStringSubmatch briefly with some examples
  • how to set flags
    => Missing in concept. Mentioned in hints of associated ParsingLogFiles exercise.
  • using e.g. https://regex101.com/ to help with writing/reading regex
    => Done

@ErikSchierboom ErikSchierboom added x:size/large Large amount of work and removed x:size/large Large amount of work labels Apr 26, 2022
@junedev
Copy link
Member Author

junedev commented Apr 26, 2022

@norbs57 Thanks for the summary, I created a small follow up issue.

@junedev junedev added the x:rep/large Large amount of reputation label Apr 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted x:action/create Work on something from scratch x:knowledge/intermediate Quite a bit of Exercism knowledge required x:module/concept-exercise Work on Concept Exercises x:rep/large Large amount of reputation x:size/large Large amount of work x:status/claimed Someone is working on this issue x:type/content Work on content (e.g. exercises, concepts)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants