title: Use dplyr::select's where with base R grepl and anonymus function
body: <p>There is a very similar question here: <a href="https://stackoverflow.com/questions/43314777/how-to-select-columns-based-on-grep-in-dplyrtibble">How to select columns based on grep in dplyr::tibble</a></p>
  <p>However I think that the <code>select_if</code> was superseeded with <code>select(where())</code>.</p>
  <p>I know that I can do the following and it works:</p>
  <pre><code># select all columns with three characters
  mtcars %&gt;% 
    select(
      matches(&quot;^[a-zA-Z]{3}$&quot;)
    )
  </code></pre>
  <p>But I can also use an anonymus function (here over all the column values and not the names) to select columns.</p>
  <pre><code>mtcars %&gt;% 
    select(
      where(function(x)sum(is.na(x)) == 0)
    )
  </code></pre>
  <p>So I thought I could use an anonymus function and <code>grepl</code> to select columns. And this does not work:</p>
  <pre><code>mtcars %&gt;% 
    select(
      where(
        function(x) grepl(&quot;^[a-zA-Z]{3}$&quot;, x)
      )
    )
  </code></pre>
  <p>How could I make this work? I mean I could always use the <code>matches</code> helper. But I would just like to understand how to use</p>
  <p><code>select(where())</code> statement over the names of the dataframe and not over all the values in a column.</p>
  <p><strong>Update</strong></p>
  <p>This works:</p>
  <pre><code>mtcars %&gt;% 
    select(
        which(grepl(&quot;^[a-zA-Z]{3}$&quot;, names(.)))
    )
  </code></pre>
  <p>But I am not sure if there isn't a better way;)</p>