How to get string by trimming *
at start (if present) and end (if present) of given string using RegExp in PHP?
Are you sure you need regex? PHP's trim()
function allows you to specify a character list to trim from either side:
$stripAsterisks = trim($string, '*');