Skip to content

Commit

Permalink
Clarify language and fix typo in Regular Expression concept docs (#378)
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinmcgimpsey authored Oct 23, 2023
1 parent 882e058 commit 8446335
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions concepts/regular-expressions/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The most common way to create regular expressions is using the `regex.from_strin
let assert Ok(re) = regex.from_string("test")
```

The regular expression creation functions an error if the regular expression syntax is invalid, so a let-assertion has been used here to ensure the regular expression is valid.
The `regex.from_string` function yields an `Error` if the regular expression syntax is invalid, so a let-assertion has been used here to ensure the regular expression is valid.

The `regex.check` function can be used to check if a regular expression matches a string.

Expand All @@ -33,7 +33,7 @@ regex.check(re, "this is too")

## Captures

If you wish to capture substrings using a regular expression the `regex.scan` function can be used to return a list of matches.
If you wish to capture substrings using a regular expression, the `regex.scan` function can be used to return a list of matches.

```gleam
let assert Ok(re) = regex.from_string("[oi]n a (\\w+)")
Expand Down
4 changes: 2 additions & 2 deletions concepts/regular-expressions/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The most common way to create regular expressions is using the `regex.from_strin
let assert Ok(re) = regex.from_string("test")
```

The regular expression creation functions an error if the regular expression syntax is invalid, so a let-assertion has been used here to ensure the regular expression is valid.
The `regex.from_string` function yields an `Error` if the regular expression syntax is invalid, so a let-assertion has been used here to ensure the regular expression is valid.

The `regex.check` function can be used to check if a regular expression matches a string.

Expand All @@ -33,7 +33,7 @@ regex.check(re, "this is too")

## Captures

If you wish to capture substrings using a regular expression the `regex.scan` function can be used to return a list of matches.
If you wish to capture substrings using a regular expression, the `regex.scan` function can be used to return a list of matches.

```gleam
let assert Ok(re) = regex.from_string("[oi]n a (\\w+)")
Expand Down

0 comments on commit 8446335

Please sign in to comment.