<?php $re = '~[mwf]|th?|su?~'; $str = "mwftthssu"; preg_match_all($re, $str, $matches);print_r($matches[0]);
Standard input is empty
Array ( [0] => m [1] => w [2] => f [3] => t [4] => th [5] => s [6] => su )
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!