I want to be able to detect/pick apart strings like :
tickets at entrance per person
ballons pp
tree planting
i.e. a description followed by an optional "pp" or "per person"
I try (.+)\s+(per person|pp)
and that works; but the pp|per person
suffix is then not optional.
I try (.+)\s+(per person|pp)?
or (.+)\s+(per person|pp){0,1}
to make it optional, but then I get "undefined for the second capture group".
Curiously the first capture group contains the "per":
matches: 0: (tickets at entrance per )
1: (tickets at entrance per)
2: (undefined)(tested via http://www.regextester.com/ online regex tester)
What am I doing wrong with that second capture group ?