$subject = "this has 7 words and 31 letters"; $result = preg_replace(array('/\d+/', '/[a-z]+/'), array('num<\0>', 'word<\0>'), $subject); print "result: $result\n"; ----------------------------------------------------------------------------- Copyright 1997-2024 Jeffrey Friedl