Description Usage Arguments Value Examples

Invert a matrix of match locations to match the opposite of what was previously matched.

1 | ```
invert_match(loc)
``` |

`loc` |
matrix of match locations, as from |

numeric match giving locations of non-matches

1 2 3 4 5 6 | ```
numbers <- "1 and 2 and 4 and 456"
num_loc <- str_locate_all(numbers, "[0-9]+")[[1]]
str_sub(numbers, num_loc[, "start"], num_loc[, "end"])
text_loc <- invert_match(num_loc)
str_sub(numbers, text_loc[, "start"], text_loc[, "end"])
``` |

```
[1] "1" "2" "4" "456"
[1] "" " and " " and " " and " ""
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.