stringi (version 0.2-5)

stri_replace_all_fixed: Replace Occurrences of a Fixed Pattern Matches

Description

Replaces with the given replacement string every/first/last substring of the input that matches the pattern.

Usage

stri_replace_all_fixed(str, pattern, replacement)

stri_replace_first_fixed(str, pattern, replacement)

stri_replace_last_fixed(str, pattern, replacement)

Arguments

str
character vector of strings to search in
pattern
character vector of patterns to search for
replacement
character vector of strings to replace with

Value

  • Each function returns a character vector.

Details

Vectorized over str, pattern, and replacement.

For natural language processing this function may be not give you desired results. Refer to stringi-search-fixed for more details.

These functions scan the input string for matches of the pattern. Input that is not part of any match is left unchanged; each match is replaced in the result by the replacement string.

See Also

Other search_fixed: stri_count_fixed; stri_detect_fixed; stri_locate_all_fixed, stri_locate_first_fixed, stri_locate_first_fixed, stri_locate_last_fixed, stri_locate_last_fixed; stri_split_fixed; stringi-search-fixed; stringi-search

Other search_replace: stri_replace_all_charclass, stri_replace_first_charclass, stri_replace_first_charclass, stri_replace_last_charclass, stri_replace_last_charclass; stri_replace_all_coll, stri_replace_first_coll, stri_replace_first_coll, stri_replace_last_coll, stri_replace_last_coll; stri_replace_all_regex, stri_replace_first_regex, stri_replace_first_regex, stri_replace_last_regex, stri_replace_last_regex; stri_replace_all; stri_replace_first; stri_replace_last; stri_replace_na; stri_replace; stringi-search

Examples

Run this code
s <- "Lorem ipsum dolor sit amet, consectetur adipisicing elit."

if (stri_install_check(silent=TRUE))
stri_replace_all_fixed(s, "", "#")

if (stri_install_check(silent=TRUE))
stri_replace_all_fixed(s, "o", "0")

Run the code above in your browser using DataLab