Skip to content

Commit

Permalink
Merge pull request #167 from PhilReedData/gh-pages
Browse files Browse the repository at this point in the history
Explained case flags further
  • Loading branch information
sharilaster authored Mar 6, 2020
2 parents fad782f + 5bfa3f1 commit 14ebb6e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion _episodes/01-regular-expressions.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,12 @@ Then test each other on the answers. If you want to check your logic use [regex1
> > \b[Cc]olou?r\b|\bCOLOU?R\b
> > /colou?r/i
> > ~~~
> > In real life, you *should* only come across the case insensitive variations `colour`, `color`, `Colour`, `Color`, `COLOUR`, and `COLOR` (rather than, say, `coLour`). So based on what we know, the logical regular expression is `\b[Cc]olou?r\b|\bCOLOU?R\b`. An alternative more elegant option we've not discussed is to take advantage of the `/` delimiters and add an 'ignore case' flag: so `/colou?r/i` will match all case insensitive variants of `colour` and `color`.
> > In real life, you *should* only come across the case insensitive variations `colour`, `color`, `Colour`, `Color`, `COLOUR`, and `COLOR` (rather than, say, `coLour`). So based on what we know, the logical regular expression is `\b[Cc]olou?r\b|\bCOLOU?R\b`.
> >
> > An alternative more elegant option we've not discussed is to take advantage of the `/` delimiters and add an 'ignore case' flag.
> > To use these flags, include `/` delimiters before and after the expression then letters after to raise each flag (where `i` is
> > 'ignore case'):
> > so `/colou?r/i` will match all case insensitive variants of `colour` and `color`.
> {: .solution}
{: .challenge}
Expand Down

0 comments on commit 14ebb6e

Please sign in to comment.