This labels the rows special characters as TRUE.
library(tidyverse)
#> Warning: package 'tibble' was built under R version 4.1.2
# Toy data
df <- tibble(
x = c("123Abcde789",
"46765%-''098",
"565--456A",
"1232133456",
"'''890976")
)
df <- df |> mutate(Flag=str_detect(x,"[^-A-Za-z0-9]"))
df
#> # A tibble: 5 x 2
#> x Flag
#> <chr> <lgl>
#> 1 123Abcde789 FALSE
#> 2 46765%-''098 TRUE
#> 3 565--456A FALSE
#> 4 1232133456 FALSE
#> 5 '''890976 TRUE
Created on 2022-04-02 by the reprex package (v2.0.1)