PHP preg_replace Function

Is there a known issue or constraint using PHP preg_replace in Scriptcase 9.3?

I want to strip non-numeric characters from phone numbers using preg_replace and then update the table while reviewing new records. I?m getting inconsistent results (sometimes the application compiles, other times not). I?m placing the PHP script within a button and checking to see if the character field has any content. The application has nine phone fields during which most are null, but I want to address all phone fields at the same time.

if (strlen({Talent_Phone}) > 3) {
$_Talent_Phone = preg_replace("/[^0-9]/", “”, {Talent_Phone});
}

Because 99% of the source information comes via API from an external system which I cannot control.

What must be done when strlen({Talent_Phone}) <=3? So what i would do during tests is [LIST=1]

  • to add a ELSE and echo strlen({Talent_Phone} in there. Just to check why php skip the preg_replace.
  • are you sure this is the correct format (/[^0-9]/)? [/LIST]