I have this vector:
jvm<-c("test - PROD_DB_APP_185b@SERVER01" ,"uat - PROD_DB_APP_SYS[1]@SERVER2")
I need to extract text until "[" or if there is no "[", then until the "@" character.
result should be
PROD_DB_APP_185b
PROD_DB_APP_SYS
I've tried something like this:
str_match(jvm, ".*\\-([^\\.]*)([.*)|(@.*)")
not working, any ides?
I have this vector- If this were a string you could match something, using(?<=-[ ])[^\[@]+(?=[\[@])sub("^.*?\\s+-\\s+([^@[]+).*", "\\1", jvm)str_extract(jvm, "(?<=- )[^@\\[]+")