A string contains some words separated by comma or space. Using PHP, I want to select first three words which have have minimum 4 characters(a-Z, 0-9, -, _, #).
For example
$words = aa, one, ab%c, four, five six#
How to select ‘four’, ‘five’, six# ? (probably with for each?)
Dalen’s suggestion would run much faster if you have no strict requirements for characters allowed. But here is a regex solution since you mention character requirements.
And you’ll just have to cut out what you want from the array after like in Dalen’s answer.