in reply to Regex text extraction b/w first intance of pattern X and third instance of pattern Y.

The "third instance of c" really means "everything not a c plus a c, plus everything not a c plus c, plus everything not a c upto but excluding the next c":

"abcbcbc" =~ m[ a ( [^c]* c [^c]* c [^c]* ) c ]x and print "'$1'";; 'bcbcb' ## or "abcbcbc" =~ m[a((?:[^c]*c){2}[^c]*)c] and print "'$1'";; 'bcbcb'

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"I'd rather go naked than blow up my ass"
  • Comment on Re: Regex text extraction b/w first intance of pattern X and third instance of pattern Y.
  • Download Code