<?php $sitelist = 'SC001rug,SC002nw,SC003nrge'; $siteId = preg_quote('SC001', '/'); $regex = "/$siteId\K[^\s,]+/"; if (preg_match($regex, $sitelist, $matches)) { var_export($matches); } else { echo "no match"; }
You have javascript disabled. You will not be able to edit any code.