Skip to main content
1 of 3
M--
  • 1.3k
  • 8
  • 16

Obviously I can port the pattern used in JS answers like this:

R, 35 bytes

\(x)grepl("\\bIll(?![aiou])",x,T,T)

Attempt This Online!


But a bit different would be:

R, 34 bytes

\(x)grepl("\\bIll([^aiou]|$)",x,T)

Attempt This Online!

grepl(
  "            
  \\b          # a word boundary
  Ill          # followed by "Ill"
  ([^aiou]|$)  # followed by either a non-aiou character OR end of string"
  "  
  x,           
  T            # ignore.case = TRUE
)
M--
  • 1.3k
  • 8
  • 16