VOOZH about

URL: https://www.geeksforgeeks.org/r-language/seek-a-match-for-the-pattern-in-the-string-in-r-programming-pmatch-function/

⇱ Seek a Match for the Pattern in the String in R Programming - pmatch() Function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Seek a Match for the Pattern in the String in R Programming - pmatch() Function

Last Updated : 15 Jul, 2025
pmatch() function in R Language is used to seek match for the pattern passed as argument. It returns the strings that begin with the pattern being searched.
Syntax: pmatch(pat, string, nomatch) Parameters: pat: pattern vector to be searched string: vector to be matched nomatch: return when no match is found
Example 1: Output:
[1] "Geeks" "Books" "geek" 
[1] 3
[1] 2
Example 2: Output:
[1] "Geeks" "Books" "geek" 
[1] 1 2 -1
Comment
Article Tags:

Explore