# grep(pattern, x, ignore.case = FALSE, perl = FALSE, value = FALSE,
#      fixed = FALSE, useBytes = FALSE, invert = FALSE)

# grepl(pattern, x, ignore.case = FALSE, perl = FALSE,
#       fixed = FALSE, useBytes = FALSE)

# sub(pattern, replacement, x, ignore.case = FALSE, perl = FALSE,
#     fixed = FALSE, useBytes = FALSE)

# gsub(pattern, replacement, x, ignore.case = FALSE, perl = FALSE,
#      fixed = FALSE, useBytes = FALSE)

# regexpr(pattern, text, ignore.case = FALSE, perl = FALSE,
#         fixed = FALSE, useBytes = FALSE)

# gregexpr(pattern, text, ignore.case = FALSE, perl = FALSE,
#          fixed = FALSE, useBytes = FALSE)

# regexec(pattern, text, ignore.case = FALSE,
#         fixed = FALSE, useBytes = FALSE)



original <- c("N.J.", "NN.JJ.", "N.Y.", "Pa.")
ptrn  <- "\\."
repl  <- "@" 


ptrn <- "[a-zA-Z]\\.[a-zA-Z]\\."

grep(pattern=ptrn, x=original)
grepl(pattern=ptrn, x=original)
sub(pattern=ptrn, replacement=repl, x=original)
gsub(pattern=ptrn, replacement=repl, x=original)
regexpr(pattern=ptrn, text=original)
gregexpr(pattern=ptrn, text=original)  # this one returns all locations of matches


