Skip to content

Commit 3b02997

Browse files
No content updates, bump version, addresses #340
1 parent 3887ca9 commit 3b02997

File tree

6 files changed

+79
-78
lines changed

6 files changed

+79
-78
lines changed

_freeze/html/strings/execute-results/html.json

Lines changed: 3 additions & 2 deletions
Large diffs are not rendered by default.

html/images/logo-stringr.png

-150 Bytes
Loading

html/strings.qmd

Lines changed: 76 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -442,26 +442,26 @@ see <- function(rx) str_view("abc ABC 123\t.!?\\(){}\n", rx)
442442

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

445-
+-------------+--------------+-----------------+--------------------------------------+
446-
| regexp | matches | example | example output\ |
447-
| | | | (highlighted characters are in \<\>) |
448-
+=============+==============+=================+======================================+
449-
| `ab|d` | or | `alt("ab|d")` | ``` |
450-
| | | | <ab>c<d>e |
451-
| | | | ``` |
452-
+-------------+--------------+-----------------+--------------------------------------+
453-
| `[abe]` | one of | `alt("[abe]"` | ``` |
454-
| | | | <a><b>cd<e> |
455-
| | | | ``` |
456-
+-------------+--------------+-----------------+--------------------------------------+
457-
| `[^abe]` | anything but | `alt("[^abe]")` | ``` |
458-
| | | | ab<c><d>e |
459-
| | | | ``` |
460-
+-------------+--------------+-----------------+--------------------------------------+
461-
| `[a-c]` | range | `alt("[a-c]")` | ``` |
462-
| | | | <a><b><c>de |
463-
| | | | ``` |
464-
+-------------+--------------+-----------------+--------------------------------------+
445+
+----------+--------------+-----------------+--------------------------------------+
446+
| regexp | matches | example | example output\ |
447+
| | | | (highlighted characters are in \<\>) |
448+
+==========+==============+=================+======================================+
449+
| `ab|d` | or | `alt("ab|d")` | ``` |
450+
| | | | <ab>c<d>e |
451+
| | | | ``` |
452+
+----------+--------------+-----------------+--------------------------------------+
453+
| `[abe]` | one of | `alt("[abe]"` | ``` |
454+
| | | | <a><b>cd<e> |
455+
| | | | ``` |
456+
+----------+--------------+-----------------+--------------------------------------+
457+
| `[^abe]` | anything but | `alt("[^abe]")` | ``` |
458+
| | | | ab<c><d>e |
459+
| | | | ``` |
460+
+----------+--------------+-----------------+--------------------------------------+
461+
| `[a-c]` | range | `alt("[a-c]")` | ``` |
462+
| | | | <a><b><c>de |
463+
| | | | ``` |
464+
+----------+--------------+-----------------+--------------------------------------+
465465

466466
: Alternates
467467

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

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

487-
+-------------+-----------------+-------------------+--------------------------------------+
488-
| regexp | matches | example | example output\ |
489-
| | | | (highlighted characters are in \<\>) |
490-
+=============+=================+===================+======================================+
491-
| `a(?=c)` | followed by | `look("a(?=c)")` | ``` |
492-
| | | | b<a>cad |
493-
| | | | ``` |
494-
+-------------+-----------------+-------------------+--------------------------------------+
495-
| `a(?!c)` | not followed by | `look("a(?!c)")` | ``` |
496-
| | | | bac<a>d |
497-
| | | | ``` |
498-
+-------------+-----------------+-------------------+--------------------------------------+
499-
| `(?<=b)a` | preceded by | `look("(?<=b)a")` | ``` |
500-
| | | | b<a>cad |
501-
| | | | ``` |
502-
+-------------+-----------------+-------------------+--------------------------------------+
503-
| `(?<!b)a` | not preceded by | `look("(?<!b)a")` | ``` |
504-
| | | | bac<a>d |
505-
| | | | ``` |
506-
+-------------+-----------------+-------------------+--------------------------------------+
487+
+-----------+-----------------+-------------------+--------------------------------------+
488+
| regexp | matches | example | example output\ |
489+
| | | | (highlighted characters are in \<\>) |
490+
+===========+=================+===================+======================================+
491+
| `a(?=c)` | followed by | `look("a(?=c)")` | ``` |
492+
| | | | b<a>cad |
493+
| | | | ``` |
494+
+-----------+-----------------+-------------------+--------------------------------------+
495+
| `a(?!c)` | not followed by | `look("a(?!c)")` | ``` |
496+
| | | | bac<a>d |
497+
| | | | ``` |
498+
+-----------+-----------------+-------------------+--------------------------------------+
499+
| `(?<=b)a` | preceded by | `look("(?<=b)a")` | ``` |
500+
| | | | b<a>cad |
501+
| | | | ``` |
502+
+-----------+-----------------+-------------------+--------------------------------------+
503+
| `(?<!b)a` | not preceded by | `look("(?<!b)a")` | ``` |
504+
| | | | bac<a>d |
505+
| | | | ``` |
506+
+-----------+-----------------+-------------------+--------------------------------------+
507507

508508
: Look arounds
509509

510510
### Quantifiers
511511

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

514-
+-------------+---------------------+-------------------+--------------------------------------+
515-
| regexp | matches | example | example output\ |
516-
| | | | (highlighted characters are in \<\>) |
517-
+=============+=====================+===================+======================================+
518-
| `a?` | zero or one | `quant("a?")` | ``` |
519-
| | | | <>.<a><>.<a><a><>.<a><a><a><> |
520-
| | | | ``` |
521-
+-------------+---------------------+-------------------+--------------------------------------+
522-
| `a*` | zero or more | `quant("a*")` | ``` |
523-
| | | | <>.<a><>.<aa><>.<aaa><> |
524-
| | | | ``` |
525-
+-------------+---------------------+-------------------+--------------------------------------+
526-
| `a+` | one or more | `quant("a+")` | ``` |
527-
| | | | .<a>.<aa>.<aaa> |
528-
| | | | ``` |
529-
+-------------+---------------------+-------------------+--------------------------------------+
530-
| `a{n}` | exactly `n` | `quant("a{2}")` | ``` |
531-
| | | | .a.<aa>.<aa>a |
532-
| | | | ``` |
533-
+-------------+---------------------+-------------------+--------------------------------------+
534-
| `a{n, }` | `n` or more | `quant("a{2,}")` | ``` |
535-
| | | | .a.<aa>.<aaa> |
536-
| | | | ``` |
537-
+-------------+---------------------+-------------------+--------------------------------------+
538-
| `a{n, m}` | between `n` and `m` | `quant("a{2,4}")` | ``` |
539-
| | | | .a.<aa>.<aaa> |
540-
| | | | ``` |
541-
+-------------+---------------------+-------------------+--------------------------------------+
514+
+-----------+---------------------+-------------------+--------------------------------------+
515+
| regexp | matches | example | example output\ |
516+
| | | | (highlighted characters are in \<\>) |
517+
+===========+=====================+===================+======================================+
518+
| `a?` | zero or one | `quant("a?")` | ``` |
519+
| | | | <>.<a><>.<a><a><>.<a><a><a><> |
520+
| | | | ``` |
521+
+-----------+---------------------+-------------------+--------------------------------------+
522+
| `a*` | zero or more | `quant("a*")` | ``` |
523+
| | | | <>.<a><>.<aa><>.<aaa><> |
524+
| | | | ``` |
525+
+-----------+---------------------+-------------------+--------------------------------------+
526+
| `a+` | one or more | `quant("a+")` | ``` |
527+
| | | | .<a>.<aa>.<aaa> |
528+
| | | | ``` |
529+
+-----------+---------------------+-------------------+--------------------------------------+
530+
| `a{n}` | exactly `n` | `quant("a{2}")` | ``` |
531+
| | | | .a.<aa>.<aa>a |
532+
| | | | ``` |
533+
+-----------+---------------------+-------------------+--------------------------------------+
534+
| `a{n, }` | `n` or more | `quant("a{2,}")` | ``` |
535+
| | | | .a.<aa>.<aaa> |
536+
| | | | ``` |
537+
+-----------+---------------------+-------------------+--------------------------------------+
538+
| `a{n, m}` | between `n` and `m` | `quant("a{2,4}")` | ``` |
539+
| | | | .a.<aa>.<aaa> |
540+
| | | | ``` |
541+
+-----------+---------------------+-------------------+--------------------------------------+
542542

543543
: Quantifiers
544544

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

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

551-
+-------------+-----------------+------------------+--------------------------------------+
552-
| regexp | matches | example | example output\ |
553-
| | | | (highlighted characters are in \<\>) |
554-
+=============+=================+==================+======================================+
555-
| `(ab|d)e` | sets precedence | `alt("(ab|d)e")` | ``` |
556-
| | | | abc<de> |
557-
| | | | ``` |
558-
+-------------+-----------------+------------------+--------------------------------------+
551+
+-----------+-----------------+------------------+--------------------------------------+
552+
| regexp | matches | example | example output\ |
553+
| | | | (highlighted characters are in \<\>) |
554+
+===========+=================+==================+======================================+
555+
| `(ab|d)e` | sets precedence | `alt("(ab|d)e")` | ``` |
556+
| | | | abc<de> |
557+
| | | | ``` |
558+
+-----------+-----------------+------------------+--------------------------------------+
559559

560560
: Groups
561561

keynotes/strings.key

-944 Bytes
Binary file not shown.

pngs/strings/strings.001.png

383 KB
Loading

strings.pdf

-19.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)