BLACK FRIDAY EXTRA SAVINGS EVENT - EXTENDED
START FREE

Boundary() for regex

Screen Link:
https://app.dataquest.io/c/69/m/399/regular-expression-basics/10/word-boundaries

My Code:

pattern  <-  boundary("[Jj]ava")
java_titles  <-  titles[str_detect(titles, pattern)]
Error in match.arg(type): 'arg' should be one of “character”, “line_break”, “sentence”, “word”
Traceback:

1. boundary(c("[Jj]ava"))
2. match.arg(type)
3. stop(gettextf("'arg' should be one of %s", paste(dQuote(choices), 
 .     collapse = ", ")), domain = NA)

This dataquest screen states you can use both \b or boundary() for word boundary conditions and get the same result. I tried to run the solution code with the same regex pattern just with boundary() instead of enclosing in \b and I recieved the error above.