hi this is my Regex code
var concatedString = concatedSubstring.replace(/\//g, '-').replace(/([0-9])([a-zA- Z])/g,"$1-$2").replace(/[A-Za-z]/g, function(c){
return c.toUpperCase().charCodeAt(0)-64;
I am trying to convert it to PHP regex what I have done is
$pin = preg_replace('{/\//g}', '-', $pin);
$pin = preg_replace('{/([0-9])([a-zA-Z])/g}','$1-$2', $pin);
$pin3 = preg_replace('{/[A-Za-z]/g}', strtoupper($pin), $pin );
echo $pin3;
I cant progress any further.
You don’t need those
{}around everything.Also, in your last
preg_replace, you’re matching[a-zA-Z]and replacing with upper-case – but if it’s upper case in the first place, there’s no need to replace it: