VOOZH about

URL: https://www.geeksforgeeks.org/r-language/check-for-a-pattern-in-the-vector-in-r-programming-grepl-function/

⇱ Check for a Pattern in the Vector in R Programming - grepl() Function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Check for a Pattern in the Vector in R Programming - grepl() Function

Last Updated : 15 Jul, 2025
grepl() function in R Language is used to return the value True if the specified pattern is found in the vector and false if it is not found.
Syntax: grepl(pattern, string, ignore.case=FALSE) Parameters: pattern: regular expressions pattern string: character vector to be searched ignore.case: whether to ignore case in the search. Here ignore.case is an optional parameter as is set to FALSE by default.
Example 1: Output:
[1] TRUE TRUE FALSE FALSE
[1] TRUE TRUE TRUE TRUE
Example 2: Output:
[1] FALSE TRUE FALSE FALSE
[1] FALSE FALSE TRUE TRUE
Comment

Explore