PHP determine masked string

Here is a preg_match expression for finding if a string contains a certain set of repeated characters, say like the masking characters in a stored credit number or say a hidden phone number

if(preg_match("/x{5,12}/","THE STRING"))  // if there are 12 consecutive x in the string, starting from position 6

 

Leave a Reply