Skip to content

Commit

Permalink
No content updates, bump version, addresses #340
Browse files Browse the repository at this point in the history
  • Loading branch information
mine-cetinkaya-rundel committed May 29, 2024
1 parent 3887ca9 commit 3b02997
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 78 deletions.
5 changes: 3 additions & 2 deletions _freeze/html/strings/execute-results/html.json

Large diffs are not rendered by default.

Binary file modified html/images/logo-stringr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
152 changes: 76 additions & 76 deletions html/strings.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -442,26 +442,26 @@ see <- function(rx) str_view("abc ABC 123\t.!?\\(){}\n", rx)

`alt <- function(rx) str_view("abcde", rx)`

+-------------+--------------+-----------------+--------------------------------------+
| regexp | matches | example | example output\ |
| | | | (highlighted characters are in \<\>) |
+=============+==============+=================+======================================+
| `ab|d` | or | `alt("ab|d")` | ``` |
| | | | <ab>c<d>e |
| | | | ``` |
+-------------+--------------+-----------------+--------------------------------------+
| `[abe]` | one of | `alt("[abe]"` | ``` |
| | | | <a><b>cd<e> |
| | | | ``` |
+-------------+--------------+-----------------+--------------------------------------+
| `[^abe]` | anything but | `alt("[^abe]")` | ``` |
| | | | ab<c><d>e |
| | | | ``` |
+-------------+--------------+-----------------+--------------------------------------+
| `[a-c]` | range | `alt("[a-c]")` | ``` |
| | | | <a><b><c>de |
| | | | ``` |
+-------------+--------------+-----------------+--------------------------------------+
+----------+--------------+-----------------+--------------------------------------+
| regexp | matches | example | example output\ |
| | | | (highlighted characters are in \<\>) |
+==========+==============+=================+======================================+
| `ab|d` | or | `alt("ab|d")` | ``` |
| | | | <ab>c<d>e |
| | | | ``` |
+----------+--------------+-----------------+--------------------------------------+
| `[abe]` | one of | `alt("[abe]"` | ``` |
| | | | <a><b>cd<e> |
| | | | ``` |
+----------+--------------+-----------------+--------------------------------------+
| `[^abe]` | anything but | `alt("[^abe]")` | ``` |
| | | | ab<c><d>e |
| | | | ``` |
+----------+--------------+-----------------+--------------------------------------+
| `[a-c]` | range | `alt("[a-c]")` | ``` |
| | | | <a><b><c>de |
| | | | ``` |
+----------+--------------+-----------------+--------------------------------------+

: Alternates

Expand All @@ -484,61 +484,61 @@ see <- function(rx) str_view("abc ABC 123\t.!?\\(){}\n", rx)

`look <- function(rx) str_view("bacad", rx)`

+-------------+-----------------+-------------------+--------------------------------------+
| regexp | matches | example | example output\ |
| | | | (highlighted characters are in \<\>) |
+=============+=================+===================+======================================+
| `a(?=c)` | followed by | `look("a(?=c)")` | ``` |
| | | | b<a>cad |
| | | | ``` |
+-------------+-----------------+-------------------+--------------------------------------+
| `a(?!c)` | not followed by | `look("a(?!c)")` | ``` |
| | | | bac<a>d |
| | | | ``` |
+-------------+-----------------+-------------------+--------------------------------------+
| `(?<=b)a` | preceded by | `look("(?<=b)a")` | ``` |
| | | | b<a>cad |
| | | | ``` |
+-------------+-----------------+-------------------+--------------------------------------+
| `(?<!b)a` | not preceded by | `look("(?<!b)a")` | ``` |
| | | | bac<a>d |
| | | | ``` |
+-------------+-----------------+-------------------+--------------------------------------+
+-----------+-----------------+-------------------+--------------------------------------+
| regexp | matches | example | example output\ |
| | | | (highlighted characters are in \<\>) |
+===========+=================+===================+======================================+
| `a(?=c)` | followed by | `look("a(?=c)")` | ``` |
| | | | b<a>cad |
| | | | ``` |
+-----------+-----------------+-------------------+--------------------------------------+
| `a(?!c)` | not followed by | `look("a(?!c)")` | ``` |
| | | | bac<a>d |
| | | | ``` |
+-----------+-----------------+-------------------+--------------------------------------+
| `(?<=b)a` | preceded by | `look("(?<=b)a")` | ``` |
| | | | b<a>cad |
| | | | ``` |
+-----------+-----------------+-------------------+--------------------------------------+
| `(?<!b)a` | not preceded by | `look("(?<!b)a")` | ``` |
| | | | bac<a>d |
| | | | ``` |
+-----------+-----------------+-------------------+--------------------------------------+

: Look arounds

### Quantifiers

`quant <- function(rx) str_view(".a.aa.aaa", rx)`

+-------------+---------------------+-------------------+--------------------------------------+
| regexp | matches | example | example output\ |
| | | | (highlighted characters are in \<\>) |
+=============+=====================+===================+======================================+
| `a?` | zero or one | `quant("a?")` | ``` |
| | | | <>.<a><>.<a><a><>.<a><a><a><> |
| | | | ``` |
+-------------+---------------------+-------------------+--------------------------------------+
| `a*` | zero or more | `quant("a*")` | ``` |
| | | | <>.<a><>.<aa><>.<aaa><> |
| | | | ``` |
+-------------+---------------------+-------------------+--------------------------------------+
| `a+` | one or more | `quant("a+")` | ``` |
| | | | .<a>.<aa>.<aaa> |
| | | | ``` |
+-------------+---------------------+-------------------+--------------------------------------+
| `a{n}` | exactly `n` | `quant("a{2}")` | ``` |
| | | | .a.<aa>.<aa>a |
| | | | ``` |
+-------------+---------------------+-------------------+--------------------------------------+
| `a{n, }` | `n` or more | `quant("a{2,}")` | ``` |
| | | | .a.<aa>.<aaa> |
| | | | ``` |
+-------------+---------------------+-------------------+--------------------------------------+
| `a{n, m}` | between `n` and `m` | `quant("a{2,4}")` | ``` |
| | | | .a.<aa>.<aaa> |
| | | | ``` |
+-------------+---------------------+-------------------+--------------------------------------+
+-----------+---------------------+-------------------+--------------------------------------+
| regexp | matches | example | example output\ |
| | | | (highlighted characters are in \<\>) |
+===========+=====================+===================+======================================+
| `a?` | zero or one | `quant("a?")` | ``` |
| | | | <>.<a><>.<a><a><>.<a><a><a><> |
| | | | ``` |
+-----------+---------------------+-------------------+--------------------------------------+
| `a*` | zero or more | `quant("a*")` | ``` |
| | | | <>.<a><>.<aa><>.<aaa><> |
| | | | ``` |
+-----------+---------------------+-------------------+--------------------------------------+
| `a+` | one or more | `quant("a+")` | ``` |
| | | | .<a>.<aa>.<aaa> |
| | | | ``` |
+-----------+---------------------+-------------------+--------------------------------------+
| `a{n}` | exactly `n` | `quant("a{2}")` | ``` |
| | | | .a.<aa>.<aa>a |
| | | | ``` |
+-----------+---------------------+-------------------+--------------------------------------+
| `a{n, }` | `n` or more | `quant("a{2,}")` | ``` |
| | | | .a.<aa>.<aaa> |
| | | | ``` |
+-----------+---------------------+-------------------+--------------------------------------+
| `a{n, m}` | between `n` and `m` | `quant("a{2,4}")` | ``` |
| | | | .a.<aa>.<aaa> |
| | | | ``` |
+-----------+---------------------+-------------------+--------------------------------------+

: Quantifiers

Expand All @@ -548,14 +548,14 @@ see <- function(rx) str_view("abc ABC 123\t.!?\\(){}\n", rx)

Use parentheses to set precedent (order of evaluation) and create groups

+-------------+-----------------+------------------+--------------------------------------+
| regexp | matches | example | example output\ |
| | | | (highlighted characters are in \<\>) |
+=============+=================+==================+======================================+
| `(ab|d)e` | sets precedence | `alt("(ab|d)e")` | ``` |
| | | | abc<de> |
| | | | ``` |
+-------------+-----------------+------------------+--------------------------------------+
+-----------+-----------------+------------------+--------------------------------------+
| regexp | matches | example | example output\ |
| | | | (highlighted characters are in \<\>) |
+===========+=================+==================+======================================+
| `(ab|d)e` | sets precedence | `alt("(ab|d)e")` | ``` |
| | | | abc<de> |
| | | | ``` |
+-----------+-----------------+------------------+--------------------------------------+

: Groups

Expand Down
Binary file modified keynotes/strings.key
Binary file not shown.
Binary file added pngs/strings/strings.001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified strings.pdf
Binary file not shown.

0 comments on commit 3b02997

Please sign in to comment.