$subject = " Jack A. Smith Mary B. Miller"; /* No order-related flag implies PREG_PATTERN_ORDER */ preg_match_all('/^(?P\w+) (?P\w\.) (?P\w+)$/m', $subject, $all_matches); ----------------------------------------------------------------------------- Copyright 1997-2024 Jeffrey Friedl