An example vector:
string <- "Junk1_Junk2_Junk3__ID1_Junk4_Junk5.pdf"
I am trying to subset ID1 by counting _ (underscores) from the right; so subset between the second and 3rd underscore from the right.
expected output: ID1
My attempt was to try to use the double __,
but this is not going to work, because not all my string list has it.
Attempt: (_){2}([^_]+)
Side note, I am trying to get comfortable with regex; please recommend a resource to build and test.
Any assistance is appreciated.