title: Regex Remove white spaces from a group
body: <p>Hi I have the following values </p>
  
  <pre><code>000001010016C02AB  111*
  000001010016C02    111H
  000001010016C      111 
  </code></pre>
  
  <p>And the expected output is</p>
  
  <pre><code>00000101001,C02AB,*
  00000101001,C02,H
  00000101001,C, 
  </code></pre>
  
  <p>The values might vary.The length of this string will always be 23.if a character is not present then the position will be a filled with a white space. The Regex now i have is </p>
  
  <pre><code>(^.{11})[0-9](.{5})(?:.{5})(.*)
  </code></pre>
  
  <p>But while using this Regex in the second group there are white spaces returned. I want those those white spaces to be removed.</p>
  
  <p>Current Output:</p>
  
  <pre><code>00000101001,C02AB,*
  00000101001,C02  ,H
  00000101001,C    , 
  </code></pre>
  
  <p>Could anyone help me remove the white spaces from the second group?</p>
  
  <p><a href="https://regex101.com/r/vjucI9/2/" rel="nofollow noreferrer">Demo</a></p>