title: Replacing Credit Card Numbers
body: <p>I'm using an sql to replace credit card numbers with xxxx and finding that REGEX_REPLACE does not consistently replace everything. Below is the SET command i'm using on the SQL             </p>
  
  <pre><code>SET COMMENTS_LONG = 
      REGEXP_REPLACE (COMMENTS_LONG,'\D[1-6]\d{3}.\d{4}.\d{4}.\d{3}(\d{1}.\d{3})?|\D[1-6]\d{12,15}|\D[1-6]\d{3}.\d{3}.?\d{3}.\d{5}', ' XXXXXXXXXXXXXXXX') 
  </code></pre>
  
  <p>Before</p>
  
  <blockquote>
    <p>Elizabeth aclled to change address.5430-6000-2111-1931 A</p>
  </blockquote>
  
  <p>After</p>
  
  <blockquote>
    <p>Elizabeth aclled to change address XXXXXXXXXXXXXXXX1 A </p>
  </blockquote>
  
  <p>I tried increasing the number of X but result is the same. I also find that i have to put a space in front of the first X as it appears to move 1 char to the left.</p>