0

Is it possible to match and get the capture groups of compound title case words?

ie: This is a FooBar test

So FooBar is matched and the capture groups are Foo and Bar.

I have this ([A-Z][a-z]+){2,} which matches but only captures 1 group Bar

I'm using the Lucene regular expression engine.

Thanks

BenG
  • 14,826
  • 5
  • 45
  • 60
  • From the answer to [this question](https://stackoverflow.com/questions/3537878/how-to-capture-an-arbitrary-number-of-groups-in-javascript-regexp): *"When you repeat a capturing group, in most flavors, only the last capture is kept; any previous capture is overwritten."* I don't know which regex flavour you're using, but it looks like this is what's happening. – jsheeran Jun 05 '17 at 09:42
  • ([A-Z]+[a-z]+[A-Z]+[a-z]+) – Mr Mystery Guest Jun 05 '17 at 12:42
  • @MrMysteryGuest that gives 1 capture of _FooBar_ – BenG Jun 05 '17 at 13:35
  • @BenG - Can't you split that or are you trying to do two things at once? – Mr Mystery Guest Jun 05 '17 at 13:50

0 Answers0