cdherold has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to set up what I thought would be a basic regex to pull out some text, but I can't seem to get the right code jotted down.
I am trying to match everything between "a" and the third instance of "c" in the following string: "abcbcbc" (where "b" is variable). Output should be "bcbcb". But I can't seem to find a way to set the closing parenthetical of the text capture at a point after the first instance of the closing pattern.
$body = "abcbcbc"; $body =~ /a(.*?)(third instance of c)/;
How should I specify the third instance of "c"?
Thanks Monks!
|
|---|