stri_extract_boundaries: Extract Data Between Text Boundaries¶
Description¶
These functions extract data between 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¶
|
character vector or an object coercible to |
|
single logical value; if |
|
single logical value; if |
|
additional settings for |
|
a named list with ICU BreakIterator’s settings, see |
|
|
Details¶
Vectorized over str
.
For more information on 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 the word boundaries, and all non-word characters (UBRK_WORD_NONE
rule status) are ignored.
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
TRUE
and NA
, respectively.
For stri_extract_first_*
and stri_extract_last_*
, a character vector is returned. A NA
element indicates a no-match.
See Also¶
The official online manual of stringi at https://stringi.gagolewski.com/
Gagolewski M., stringi: Fast and portable character string processing in R, Journal of Statistical Software 103(2), 2022, 1-59, doi:10.18637/jss.v103.i02
Other search_extract: about_search
, stri_extract_all()
, stri_match_all()
Other locale_sensitive: %s<%()
, about_locale
, about_search_boundaries
, about_search_coll
, stri_compare()
, stri_count_boundaries()
, stri_duplicated()
, stri_enc_detect2()
, stri_locate_all_boundaries()
, stri_opts_collator()
, stri_order()
, stri_rank()
, stri_sort()
, stri_sort_key()
, stri_split_boundaries()
, stri_trans_tolower()
, stri_unique()
, stri_wrap()
Other text_boundaries: about_search
, about_search_boundaries
, stri_count_boundaries()
, stri_locate_all_boundaries()
, stri_opts_brkiter()
, stri_split_boundaries()
, stri_split_lines()
, stri_trans_tolower()
, stri_wrap()
Examples¶
stri_extract_all_words('stringi: THE string processing package 123.48...')
## [[1]]
## [1] "stringi" "THE" "string" "processing" "package"
## [6] "123.48"