does any can convert my php code into JavaScript or j query or Ajax
this is my code
<?php
$string = '4617610105772019';
$pattern = '/[0-9]{12}/';
$replacement = 'xxxxxxx-';
echo preg_replace($pattern, $replacement, $string);
?>
the $string will be the text box inputted by the user
Try with .replace()
like
var string = '4617610105772019';
var pattern = '/[0-9]{12}/';
var replacement = 'xxxxxxx-';
var result = string.replace(pattern, replacement);
alert(result);