Possibly teach parentheses `()` for grouping

Abierto
#179 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
markdown

Línea de trabajo

Start by reading episode 1's regular expressions lesson and its Matching Dates exercises; episode 2's phone number challenges show where escaped parentheses are used. Decide how to introduce grouping parentheses and add a related exercise with its solution. Done when the lesson explains the feature and the exercise demonstrates it.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Currently the lesson doesn't teach parentheses for grouping parts of the regular expression. I think it would be worth adding this to the metacharacters taught in episode 1 because:

  1. They are commonly used in building regular expressions
  2. The introduction about regular expressions says regex can be used for the following things that parentheses supports:
* Match patterns that repeat any number of times.
* Capture the parts of the original string that match your pattern.
  1. In episode 2, when searching for the phone number with area code given in parentheses, the solution says "\( escape character with the parenthesis as straightforward character match", but parentheses have not been presented as a special character in the lesson, so the need to escape them has not been pointed out.

If added to the content in episode 1, some options for adding the () into exercises:

  1. Exercise Matching Dates: "How would you match the date format dd-MM-yyyy?" could have a follow up of how to match that same pattern with a regular expression that includes parentheses, with a solution of \b(\d{2}-){2}\d{4}\b
  2. After theMatching Dates exercise, add one that would match both the pattern dd-MM-yyyy and MM-yyyy, with a solution of \b(\d{2}-){1,2}\d{4}\b.
  3. Exercise Matching multiple date formats: How would you match the date format dd-MM-yyyy or dd-MM-yy at the end of a line only? could give a solution in place of the current one that eliminates matching a 3 digit year as is currently given such as \b\d{2}-\d{2}-\d{2}(\d{2})?\b.
  4. After the phone number related challenges in episode 2, add another that asks for a regex that matches both formats of phone numbers (with/without country code and area code given in parentheses or with dash) with a solution somewhere along the lines of (\+\d{1,3} ?|1-)?(\(\d{3}\)\s?|\d{3}-)\d{3}-\d{4}

If adding about the use of parentheses in regex is desired by others, I don't mind contributing this and integrating one (or more) of the exercise options suggested above (or some other exercise you want to suggest).

Lenguaje dominante
Sin datos de lenguaje
Estrellas
36
Forks
84
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de LibraryCarpentry/lc-data-intro

Todos los issues de LibraryCarpentry/lc-data-intro

Issues similares

Más issues de Documentation

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.