EVOLUTION-MANAGER
Edit File: modifiers.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Control matching behaviour with modifier functions.</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for modifiers {stringr}"><tr><td>modifiers {stringr}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Control matching behaviour with modifier functions.</h2> <h3>Description</h3> <dl> <dt>fixed</dt><dd><p>Compare literal bytes in the string. This is very fast, but not usually what you want for non-ASCII character sets.</p> </dd> <dt>coll</dt><dd><p>Compare strings respecting standard collation rules.</p> </dd> <dt>regex</dt><dd><p>The default. Uses ICU regular expressions.</p> </dd> <dt>boundary</dt><dd><p>Match boundaries between things.</p> </dd> </dl> <h3>Usage</h3> <pre> fixed(pattern, ignore_case = FALSE) coll(pattern, ignore_case = FALSE, locale = "en", ...) regex(pattern, ignore_case = FALSE, multiline = FALSE, comments = FALSE, dotall = FALSE, ...) boundary(type = c("character", "line_break", "sentence", "word"), skip_word_none = NA, ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>pattern</code></td> <td> <p>Pattern to modify behaviour.</p> </td></tr> <tr valign="top"><td><code>ignore_case</code></td> <td> <p>Should case differences be ignored in the match?</p> </td></tr> <tr valign="top"><td><code>locale</code></td> <td> <p>Locale to use for comparisons. See <code><a href="../../stringi/html/stri_locale_list.html">stringi::stri_locale_list()</a></code> for all possible options. Defaults to "en" (English) to ensure that the default collation is consistent across platforms.</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>Other less frequently used arguments passed on to <code><a href="../../stringi/html/stri_opts_collator.html">stringi::stri_opts_collator()</a></code>, <code><a href="../../stringi/html/stri_opts_regex.html">stringi::stri_opts_regex()</a></code>, or <code><a href="../../stringi/html/stri_opts_brkiter.html">stringi::stri_opts_brkiter()</a></code></p> </td></tr> <tr valign="top"><td><code>multiline</code></td> <td> <p>If <code>TRUE</code>, <code>$</code> and <code>^</code> match the beginning and end of each line. If <code>FALSE</code>, the default, only match the start and end of the input.</p> </td></tr> <tr valign="top"><td><code>comments</code></td> <td> <p>If <code>TRUE</code>, white space and comments beginning with <code>#</code> are ignored. Escape literal spaces with <code>\ </code>.</p> </td></tr> <tr valign="top"><td><code>dotall</code></td> <td> <p>If <code>TRUE</code>, <code>.</code> will also match line terminators.</p> </td></tr> <tr valign="top"><td><code>type</code></td> <td> <p>Boundary type to detect. </p> <dl> <dt><code>character</code></dt><dd><p>Every character is a boundary.</p> </dd> <dt><code>line_break</code></dt><dd><p>Boundaries are places where it is acceptable to have a line break in the current locale.</p> </dd> <dt><code>sentence</code></dt><dd><p>The beginnings and ends of sentences are boundaries, using intelligent rules to avoid counting abbreviations (<a href="https://www.unicode.org/reports/tr29/#Sentence_Boundaries">details</a>).</p> </dd> <dt><code>word</code></dt><dd><p>The beginnings and ends of words are boundaries.</p> </dd> </dl> </td></tr> <tr valign="top"><td><code>skip_word_none</code></td> <td> <p>Ignore "words" that don't contain any characters or numbers - i.e. punctuation. Default <code>NA</code> will skip such "words" only when splitting on <code>word</code> boundaries.</p> </td></tr> </table> <h3>See Also</h3> <p><code><a href="str_wrap.html">str_wrap()</a></code> for breaking text to form paragraphs </p> <p><code><a href="../../stringi/html/stringi-search-boundaries.html">stringi::stringi-search-boundaries</a></code> for more detail on the various boundaries </p> <h3>Examples</h3> <pre> pattern <- "a.b" strings <- c("abb", "a.b") str_detect(strings, pattern) str_detect(strings, fixed(pattern)) str_detect(strings, coll(pattern)) # coll() is useful for locale-aware case-insensitive matching i <- c("I", "\u0130", "i") i str_detect(i, fixed("i", TRUE)) str_detect(i, coll("i", TRUE)) str_detect(i, coll("i", TRUE, locale = "tr")) # Word boundaries words <- c("These are some words.") str_count(words, boundary("word")) str_split(words, " ")[[1]] str_split(words, boundary("word"))[[1]] # Regular expression variations str_extract_all("The Cat in the Hat", "[a-z]+") str_extract_all("The Cat in the Hat", regex("[a-z]+", TRUE)) str_extract_all("a\nb\nc", "^.") str_extract_all("a\nb\nc", regex("^.", multiline = TRUE)) str_extract_all("a\nb\nc", "a.") str_extract_all("a\nb\nc", regex("a.", dotall = TRUE)) </pre> <hr /><div style="text-align: center;">[Package <em>stringr</em> version 1.4.0 <a href="00Index.html">Index</a>]</div> </body></html>