I have a regex that checks for a username between 4 and 25 characters in length, followed by any optional spacebars and/or a single comma. As you may have guessed this is to be used for sending personal messages to several people by typing something like "Username1, Username2, Username3" ect.
$rule = "%^\w{4,25}( +)?,?( +)?$%";
preg_match_all($rule, $sendto, $out);
foreach($out[1] as $match) {
echo $match;
}
The regex seems to be doing its job, although when I use preg_match_all(), and attempt to sort through all the values, it will not echo anything to the browser. I suspect that I am misunderstanding something about preg_match_all, since my regex seems to be working.
preg_match_all()was successful or not before attempting to consume$out.