I have regex string data but would like to exclude a substring
dat <- c('long_regex_other_stuff','long_regex_other_random.something')
(dat[grep('long_regex',dat)])
(dat[grep('long_regex.*(?!.*something$)',dat)])
The first grep output is expected
"long_regex_other_stuff" "long_regex_other_random.something"
How to get the second grep to work? The desired output is
"long_regex_other_stuff"
Ref: Regular expression to match a line that doesn't contain a word?