I have been trying to extract a portion of string after the occurrence of a first ^
sign. For example, the string looks like abc^28092015^def^1234
. I need to extract 28092015
sandwiched between the 1st two ^
signs.
So, I need to extract 8 characters from the occurrence of the 1st ^
sign. I have been trying to extract the position of the first ^
sign and then use it as an argument in the substr function.
I tried to use this:
x=abc^28092015^def^1234 `rev(gregexpr("\\^", x)[[1]])[1]`
Referring the answer discussed here.
But it continues to return the last position. Can anyone please help me out?