Regex help please
Posted: Sun Sep 21, 2014 3:18 am
Hi.
Given the string: X1aaX1bbX1ccY
I need to pull out anything between the last X1 and Y. Anything, of any length, is allowed in the aa, bb, or cc positions. I believe it will require a look-ahead or a look-behind, but I can't solve it. I have been pondering for hours. sigh.
e.g.
X1aaX1bbX1ccY should return "cc"
X1aaX1bbX1ccabcY should return "ccabc"
X1aaX1bbX1cc1Y should return "cc1"
etc...
Thanks in advance.
Given the string: X1aaX1bbX1ccY
I need to pull out anything between the last X1 and Y. Anything, of any length, is allowed in the aa, bb, or cc positions. I believe it will require a look-ahead or a look-behind, but I can't solve it. I have been pondering for hours. sigh.
e.g.
X1aaX1bbX1ccY should return "cc"
X1aaX1bbX1ccabcY should return "ccabc"
X1aaX1bbX1cc1Y should return "cc1"
etc...
Thanks in advance.