- preg_match: documentation ( source)
- explode: documentation ( source)
<?php
/* WT-Pine-Blush-0-short-rentwithtryon-Alias */
$_itemSku = "WT-Pine-Blush-0-short-rentwithtryon-Alias";
preg_match('/([^-]+\-){6}([^-]+)$/', $_itemSku, $matches);
$result = (isset($matches[2])) ? $matches[2] : false;
if ($result) {
preg_match('/([a-z][A-Z])/', $result, $alias);
$arr = explode('', $alias);
//TODO: need to insert a space between the two items in the alias array
echo $alias;
} else {
echo "nope";
}