I am using regular expression in R with the following code:
> temp <- c("Herniorrhaphy, left inguinal", "Herniorrhaphy, right inguinal")
> grep("Herniorrhaphy, [left|right] inguinal",temp)
integer(0)
> grep("Herniorrhaphy, [left inguinal|right inguinal]",temp)
[1] 1 2
I wonder why the two regular expression give difference result, thanks.
I think you want brackets
()not character class[], ie