I'm having difficulties in extracting exactly N characters after all regex matches in one string. E.g. N=3, and regex match is an opening bracket "(", and may be paste an aux word in between if M >= 1.
x1 = "use actual (Mon 3)|(Tue 4)"
x2 = "use actual (Mon 10)"
x3 = "use actual"
Desired outputs are:
"Mon and Tue"
"Mon"
""
I started with gsub( ".*\\(", "", c("use actual (Mon 3)|(Tue 4)"))
and then tried to follow R extract part of string but got lost in ?
and wildcards.
Thanks!