I need to get substring from a string where it will give output of first 25 characters from different aspects. Here substring should only consider commas (,) not spaces.
Scenario 1:
$str = "the, quick, brown, fox";
$res = "the, quick, brown, fox";
Scenario 2:
$str = "the, quick, brown, fox, jumps, over, the, lazy, dog!";
$res = "the, quick, brown, fox, more";
Scenario 3:
$str = "the quick, brown fox, jumps over, the lazy dog!";
$res = "the quick, brown fox, more";
Scenario 4:
$str = "the quick brown fox, jumps over, the lazy dog!";
$res = "the quick brown fox, more";
Please help! Thanks.
Extremely sorry for my English!
All 4 Scenarios tested
(assuming that a comma is within the first 25 characters )
the, quick, brown, fox
the, quick, brown, fox, more
the quick, brown fox, more
the quick brown fox, more