stringi (version 1.0-1)

stri_extract_all_boundaries: Extract Text Between Text Boundaries

Description

These functions extract text between specific text boundaries.

Usage

stri_extract_all_boundaries(str, simplify = FALSE, omit_no_match = FALSE,
  ..., opts_brkiter = NULL)

stri_extract_last_boundaries(str, ..., opts_brkiter = NULL)

stri_extract_first_boundaries(str, ..., opts_brkiter = NULL)

stri_extract_all_words(str, simplify = FALSE, omit_no_match = FALSE, locale = NULL)

stri_extract_first_words(str, locale = NULL)

stri_extract_last_words(str, locale = NULL)

Arguments

str
character vector or an object coercible to
simplify
single logical value; if TRUE or NA, then a character matrix is returned; otherwise (the default), a list of character vectors is given, see Value
omit_no_match
single logical value; if FALSE, then a missing value will indicate that there are no words
...
additional settings for opts_brkiter
opts_brkiter
a named list with ICU BreakIterator's settings as generated with stri_opts_brkiter; NULL for default break iterator, i.e. line_break
locale
NULL or "" for text boundary analysis following the conventions of the default locale, or a single string with locale identifier, see stringi-locale.

Value

  • For stri_extract_all_*, if simplify=FALSE (the default), then a list of character vectors is returned. Each string consists of a separate word. In case of omit_no_match=FALSE and if there are no words or if a string is missing, a single NA is provided on output. Otherwise, stri_list2matrix with byrow=TRUE argument is called on the resulting object. In such a case, a character matrix with length(str) rows is returned. Note that stri_list2matrix's fill argument is set to an empty string and NA, for simplify equal to TRUE and NA, respectively.

    For stri_extract_first_* and stri_extract_last_*, a character vector is returned. A NA element indicates no match.

Details

Vectorized over str.

For more information on the text boundary analysis performed by ICU's BreakIterator, see stringi-search-boundaries.

In case of stri_extract_*_words, Just like in stri_count_words, ICU's word BreakIterator iterator is used to locate word boundaries, and all non-word characters (UBRK_WORD_NONE rule status) are ignored.

See Also

Other locale_sensitive: %s!==%, %s!=%, %s<=%< a="">, %s<%< a="">, %s===%, %s==%, %s>=%, %s>%, %stri!==%, %stri!=%, %stri<=%< a="">, %stri<%< a="">, %stri===%, %stri==%, %stri>=%, %stri>%; stri_cmp, stri_cmp_eq, stri_cmp_equiv, stri_cmp_ge, stri_cmp_gt, stri_cmp_le, stri_cmp_lt, stri_cmp_neq, stri_cmp_nequiv, stri_compare; stri_count_boundaries, stri_count_words; stri_duplicated, stri_duplicated_any; stri_enc_detect2; stri_locate_all_boundaries, stri_locate_all_words, stri_locate_first_boundaries, stri_locate_first_words, stri_locate_last_boundaries, stri_locate_last_words; stri_opts_collator; stri_order, stri_sort; stri_split_boundaries; stri_trans_tolower, stri_trans_totitle, stri_trans_toupper; stri_unique; stri_wrap; stringi-locale; stringi-search-boundaries; stringi-search-coll

Other search_extract: stri_extract, stri_extract_all, stri_extract_all_charclass, stri_extract_all_coll, stri_extract_all_fixed, stri_extract_all_regex, stri_extract_first, stri_extract_first_charclass, stri_extract_first_coll, stri_extract_first_fixed, stri_extract_first_regex, stri_extract_last, stri_extract_last_charclass, stri_extract_last_coll, stri_extract_last_fixed, stri_extract_last_regex; stri_match, stri_match_all, stri_match_all_regex, stri_match_first, stri_match_first_regex, stri_match_last, stri_match_last_regex; stringi-search

Other text_boundaries: stri_count_boundaries, stri_count_words; stri_locate_all_boundaries, stri_locate_all_words, stri_locate_first_boundaries, stri_locate_first_words, stri_locate_last_boundaries, stri_locate_last_words; stri_opts_brkiter; stri_split_boundaries; stri_split_lines, stri_split_lines1, stri_split_lines1; stri_trans_tolower, stri_trans_totitle, stri_trans_toupper; stri_wrap; stringi-search-boundaries; stringi-search

Examples

Run this code
stri_extract_all_words("stringi: THE string processing package 123.48...")

Run the code above in your browser using DataLab