I have to pick up consecutive capital-letter starting words in a text (using PHP preg_match()
).
So in this text - "this is Some text" it should pick up word "Some", but in this text - "this is Another Piece Of text" it should pick up "Another Piece Of".
I currently have this expression - ([A-Z][a-z]+)+
, but it only picks up every single capital case word. I need them in as a whole line (e.g - [0] => "Another Piece Of"
, but I currently get [0] => "Another", [1] => "Piece", [2] => "Of"
)
How should I update it so that it does what I need?