title: Replacing multiple values in logback
body: <p>I am trying to replace multiple values in logback logger which logs Cassandra CQL statements and used example from this post:
  <a href="https://stackoverflow.com/questions/25277930/mask-sensitive-data-in-logs-with-logback">Mask sensitive data in logs with logback</a></p>
  
  <p>where invocation of %replace function is used:</p>
  
  <pre><code>%replace(  %replace(%msg){'regex1', 'replacement1'}  ){'regex2', 'replacement2'}
  </code></pre>
  
  <p>In my case I want to replace 3 fields - name, last name and password. Statement used is:</p>
  
  <pre><code>%replace(%replace(%replace(%msg){"first_name='.*'", "first_name='xxxxx'"}){"last_name='.*'", "last_name='yyyyyy'"}){"password='.*'", "password='zzzzzz'"}%n
  </code></pre>
  
  <p>It seemed to work ok, but I noticed that if order of fields is different, values are removed sometimes. For example, </p>
  
  <p>1) when statement is in this order it is ok:</p>
  
  <p>Executed:</p>
  
  <pre><code>UPDATE usertest.users SET password='secret_pw', last_name='Smith', first_name='John' where user_id = 1745;
  </code></pre>
  
  <p>Logged:</p>
  
  <pre><code>UPDATE usertest.users SET password=zzzzzz, last_name=yyyyyy, first_name=xxxxx where user_id = 1745;
  </code></pre>
  
  <p>2) In this case last name is removed</p>
  
  <p>Executed:</p>
  
  <pre><code>UPDATE usertest.users SET password='secret_pw', first_name='John', last_name='Smith' where user_id = 1745;
  </code></pre>
  
  <p>Logged:</p>
  
  <pre><code>UPDATE usertest.users SET password=zzzzzz, first_name=xxxxx where user_id = 1745;
  </code></pre>
  
  <p>3) In this case password is removed</p>
  
  <p>Executed:</p>
  
  <pre><code>UPDATE usertest.users SET last_name='Smith', password='secret_pw', first_name='John' where user_id = 1745;
  </code></pre>
  
  <p>Logged:</p>
  
  <pre><code>UPDATE usertest.users SET last_name=yyyyyy, first_name=xxxxx where user_id = 1745;
  </code></pre>
  
  <p>Could someone advice why it could happen and how it could be fixed or is there any other way to solve?</p>