I just figured out why some strings were not matched by a regular expression and learned that the data viewer is rendering repeated whitespaces as a single one (from now on I will be using str_squish().).
Hi marco, I noticed this as well but I actually used it to my advantage when I was importing messy data that were originally .txt files. To scrape it in, I had to work around a lot of arbitrary, inconsistent white spaces. I can see how it can be an obstacle when you want to match exact whitespace lengths.
My stringr cheat sheet also says that for regular expressions, \s means "any whitespace", while [:space:] means "space characters" and [:blank:] means "space and tab (but not new line)". I wonder if you can match a [:space:]{1} pattern where {n} quantifies "exactly n times."
Not sure if [:space:] is effectively the same as \s.