Adds the $ anchor to the end of the pattern, ensuring the match must continue until the very last character of the string.

xp_wrap_end(pattern)

Arguments

pattern

A regexpert object or character string from the pipe.

Value

A regexpert object.

Examples

# Match ".com" only if it's at the very end
xp_build_literal(".com") %>% xp_wrap_end()
#> <regexpert pattern>
#>   .com$

# Match an exact 5-digit string (start to end)
xp_build_digits() %>% xp_op_repeat(5) %>% xp_wrap_start() %>% xp_wrap_end()
#> <regexpert pattern>
#>   ^(?:\d){5}$