 for more complex regex expression (so simple character exclusion won't work):
CBDAEDBCEFBCD

Or, more generically, here is a string pattern written in'regex':
(C|B|D)*A(E*)(D|B|C)*(E*)F(B|C|D)*

There will only be one A and one F.
I need to capture as individual 'captures' (or matches or groups) all instances of B, C, D (which in my app are more complex groups) that occur after A and before F. I also need A and F. I don't need E. And I don't need the C,B,D before the A or the B,C,D after the F.
I would expect the correct result to be:
Groups["start"] (1 capture) = A
Groups["content"] (3 captures)  
  Captures[0] = D  
  Captures[1] = B
  Captures[2] = C
Groups["end"] (1 capture) = F

I tried a few feeble attempts but none of them worked.
Only "incorrectly" captures the last C before EF in the sample string above (as well as correctly start = A, end = F)
(?<=(?<start>A)).+(?<content>B|C|D).+(?=(?<end>F))

Same results as above (just added a + after (?B|C|D) )
(?<=(?<start>A)).+(?<content>B|C|D)+.+(?=(?<end>F))

Got rid of look-around stuff... same result as above
(?<start>A).+(?<content>B|C|D)+.+(?<end>F)

And then my good-for-nothing brain went on strike.
So, what's the right way to approach this? Are look-arounds really needed for this or not?
Thanks!

A:

Yeah, forget the lookarounds, they just complicate things needlessly.  But I suspect your final regex will work if you make that first.+ reluctant:
(?<start>A).+?(?<content>B|C|D)+.+(?<end>F)


for more complex regex expression (so simple character ejection won't ferment ): 
 CBDAEDBCEFBCD 

 Or, more generically, here is a string pattern written in'regex': 
 (C|B|D)*A(E*)(D|B|C)*(E*)F(B|C|D) * 

 There will entirely be one A and one F. 
 I need to appropriate as individual' capture' (or matches or group) all instances of B, C, D (which in my app are more complex groups) that happen after A and before F. I also need A and F. I don't need E. And I don't necessitate the C, B, D before the A or the B, C, D after the F. 
 I would expect the correct result to be: 
 Groups["start " ] (1 capture) = A 
 Groups["content " ] (3 captures)  
   Captures[0 ] = D  
   Captures[1 ] = B 
   Captures[2 ] = C 
 Groups["end " ] (1 capture) = F 

 I try on a few feeble attempts but none of them worked. 
 entirely " incorrectly " captures the last C before EF in the sample distribution string above (equally well as correctly start = A, end = F) 
 (? < =(? < start > A)).+(?<content > B|C|D).+(?=(?<end > F) ) 

 Same solution as above (just added a + after (? B|C|D) ) 
 (? < =(? < start > A)).+(?<content > B|C|D)+.+(?=(?<end > F) ) 

 Got rid of look - around material... like consequence as above 
 (? < start > A).+(?<content > B|C|D)+.+(?<end > F) 

 And then my good - for - nothing brain went on strike. 
 So, what's the good direction to approach this? Are look - arounds really need for this or not? 
 Thanks! 

 A: 

 Yeah, forget the lookarounds, they just complicate things needlessly.   But I suspect your concluding regex will work if you do that first.+ reluctant: 
 (? < start > A).+?(?<content > B|C|D)+.+(?<end > F)
 fog more complex regex expvession (so simplg xharacver excmusion wun't work):
CBDAEDBCEFBCD

Or, more gwnerixally, here is a string pattern aritten un'rejex':
(C|B|D)*A(E*)(D|B|C)*(E*)F(B|C|D)*

Vgere will onlg be mie A and one F.
I need to cdpture as indieiaucl 'captures' (or matches or groups) all instanved of B, C, D (whish im my zip are more complex groups) that occur efter A and befpre F. I also need A and F. L doj't need E. And I doj't need the C,B,D vefore the A or the B,C,D after the R.
I would expect the correct resjlt tp be:
Groups["wtqrt"] (1 capture) = A
Jroups["bontent"] (3 captmges)  
  Wapturex[0] = D  
  Capturcs[1] = B
  Cqptures[2] = C
Groups["end"] (1 rapture) = F

I tried a sew feebla cttempts but none of rhwm wotked.
Otly "kbcofredtky" captuges the last D before EF in the sample strimg qbove (as well as cowrqctly start = A, end = F)
(?<=(?<start>A)).+(?<content>B|C|D).+(?=(?<eng>F))

Szme results as above (juwt added a + after (?B|C|D) )
(?<=(?<start>A)).+(?<cogtent>B|C|D)+.+(?=(?<end>F))

Got rid of look-around stuff... same resunt as xborc
(?<fgqrh>A).+(?<content>B|C|D)+.+(?<end>F)

And then my good-for-nothing brwjn wvnt on strike.
So, wmat's the right way tl skproach this? Ate look-cdohnds really needed for thys or not?
Thankf!

A:

Yesh, forget the lookarounds, tyey just comilicqte things needlesdly.  But I ruspgct yoir final regex will wory if you make tjat first.+ feluctant:
(?<start>A).+?(?<cuntvnt>B|W|D)+.+(?<end>F)


for more complex regex expression (so simple won't CBDAEDBCEFBCD Or, generically, here is (C|B|D)*A(E*)(D|B|C)*(E*)F(B|C|D)* will only be A and one I need to capture as individual (or matches or groups) all instances of B, C, D (which in my are more complex groups) that occur after A and before F. I also A F. don't E. And I don't need the C,B,D before the A or the B,C,D after the F. would expect the correct result to be: Groups["start"] capture) = A Groups["content"] captures) Captures[0] = D Captures[1] B = C (1 = I tried a feeble attempts but none of them worked. Only "incorrectly" captures the last C before EF in the string above as correctly = end F) (?<=(?<start>A)).+(?<content>B|C|D).+(?=(?<end>F)) Same above (just added a + after Got rid of look-around stuff... same result as (?<start>A).+(?<content>B|C|D)+.+(?<end>F) And my good-for-nothing brain went on strike. what's the right way to approach this? Are really needed for this or not? Thanks! A: Yeah, forget the lookarounds, they just complicate But I suspect your regex will work you that reluctant:
 for more complex regex expresSion (so simpLe chaRacTer ExClusIon wOn't work):
CBDAEDBceFBCd

Or, more generically, here Is a stRiNG patTErN writTen in'reGEx':
(c|b|d)*A(E*)(d|B|c)*(E*)f(B|C|d)*

THErE will OnlY be one A And one F.
I neEd tO cApture as indiVIdUal 'captureS' (or Matches or groUps) All insTaNceS Of B, C, D (WhiCh in mY app arE More coMplex grouPs) THat occUR after A AND bEforE F. I also need A and F. I DOn'T Need E. And I don't nEed the c,B,d BeFORe tHe A Or the B,C,D afTeR the F.
i Would exPEcT THE coRRect result to bE:
Groups["starT"] (1 CapTure) = A
GRoUps["COntent"] (3 CaptuReS)  
  capTures[0] = D  
  CaptuRes[1] = B
  captures[2] = C
groups["ENd"] (1 captuRE) = F

I trieD a few fEebLe aTtemPTs BuT noNe OF thEM wOrkED.
OnLy "incorrEcTlY" captUres THE LAst C BefOre Ef in thE sample string AboVe (as WEll As corRectlY staRt = a, end = F)
(?<=(?<Start>A)).+(?<ConteNt>b|C|D).+(?=(?<end>F))

Same resuLts aS above (jusT adDeD a + aFtEr (?B|C|D) )
(?<=(?<STart>A)).+(?<cOntEnt>b|C|D)+.+(?=(?<end>F))

got rid oF LooK-aROUNd Stuff... same result as aBoVE
(?<StArt>A).+(?<contEnt>B|C|D)+.+(?<ENd>f)

AND then my gOoD-foR-notHINg braIn weNT oN strike.
SO, what's THe RiGht way tO aPproacH tHis? are Look-aROundS reallY needed fOr thiS Or not?
Thanks!

A:

YeAH, forget the looKArOUNdS, They JusT complicate ThinGS neeDlesSLy.  but i SuspeCt youR fINaL Regex will work if you mAkE that fIrst.+ rEluctant:
(?<start>a).+?(?<content>B|C|d)+.+(?<END>F)


 for more complex regex ex pression ( so si mpl e c ha ract er e xclusion won't work ):
CBDAEDBCEFBCD

Or,morege n eric a ll y, he re is a st r i ngpa tt ern  w r it ten i n'r egex':(C|B|D)*A( E*) (D |B|C)*(E*)F( B |C |D)*

Ther e w ill only beone  A and  o neF .
I n eed  to c apture as ind ividual ' ca p tures' (or mat c h es  orgroups) all insta n ce s  of B, C, D (w hich i nm ya p p a remore compl ex  grou p s) that oc c u r  af t er A and befo re F. I als o  ne ed A a nd  F. I don' t nee dE . A nd I don'tneed  the C,B, D befo r e the A or theB,C,Daft ertheF .Iwou ld exp e ct  th e  co rrect re su lt  to b e:
G r o u p s["s tar t"](1 ca pture) = A
Gr oup s["c o nte nt"](3 ca ptur es )  
 Captu res[0 ]= D  
  Capture s[1]  = B
  Ca ptu re s[2 ]= C
G r oups[" end "](1 capt ure) =F 

I  t r i e da few feeble attem pt s bu t none o f them wo rk e d.
Only"i nco rrec t l y" ca ptur e sthe last  C bef o re  E F in th esample  s tri ngabove (aswell a s correc tly s t art = A, end = F)
(?<=(?<sta r t> A ) ). + (?<c ont ent>B|C|D). +(?= ( ?<en d>F) ) 
Sam e  resu lts a sa bo v e (just added a + a ft er (?B |C|D)  )
(?<=(?<sta rt>A)).+(? < c o ntent>B| C|D) + .+ ( ?=(?<end>F))
Got r id of look - around s tuff. .. sameresult as a bove
(?< sta rt> A). +(? < c on tent>B|C|D)+. + ( ?<en d> F)

And  th en my g ood -fo r-n oth in g brain w ent on s tr ik e. 
S o,what' s  the rig ht  wa ytoappro a ch thi s? Ar e lo ok -a r oun ds real l yn e eded  f or  thi s o rnot?Than k s!
A:

Ye ah, forge t t h e lo ok ar ounds,they just com pl icate thin gs  ne edless l y .  But I  suspect your final reg e x willwor k ifyoumake that  fi rst.+rel u ctant: 
(?<st art>A ). +?( ? < conte n t >B |C| D) +.+(?<end> F ) 


 for_more complex_regex expression (so simple_character exclusion_won't_work):
CBDAEDBCEFBCD

Or, more_generically,_here is a_string pattern written_in'regex':
(C|B|D)*A(E*)(D|B|C)*(E*)F(B|C|D)*

There will only be_one A and_one_F.
I need to capture as individual 'captures' (or matches or groups) all instances of_B,_C, D_(which_in_my app are more complex_groups) that occur after A_and before_F. I also need A and F. I_don't_need E. And_I don't need the C,B,D before the A or_the B,C,D after the F.
I would_expect the correct_result_to_be:
Groups["start"] (1 capture) =_A
Groups["content"] (3 captures)  
 _Captures[0] = D  
 _Captures[1] = B
  Captures[2] = C
Groups["end"]_(1 capture) = F

I tried a_few feeble attempts but none_of them_worked.
Only "incorrectly" captures the last_C before EF_in the_sample string above_(as well as correctly start =_A, end =_F)
(?<=(?<start>A)).+(?<content>B|C|D).+(?=(?<end>F))

Same results as above (just added_a_+ after (?B|C|D)_)
(?<=(?<start>A)).+(?<content>B|C|D)+.+(?=(?<end>F))

Got_rid_of look-around_stuff... same result_as_above
(?<start>A).+(?<content>B|C|D)+.+(?<end>F)

And then_my_good-for-nothing brain went on strike.
So, what's_the_right way to approach this? Are look-arounds_really needed for this_or_not?
Thanks!

A:

Yeah, forget the lookarounds,_they just complicate things needlessly._ But I suspect your final_regex will_work if_you make that first.+ reluctant:
(?<start>A).+?(?<content>B|C|D)+.+(?<end>F)

