title: How to trim exisiting whitespace at the end of the line using Regular Expression?
body: <p>Good day! I am new and exploring Regular expression. I am currently profiling the data and excluding the dirty data in our system. Now, I am having a hard time removing trailing whitespace, I dont know what built-in function should I use to eliminate this. If I put \h it wont capture the space, but if I used \s it captured the space but it has trailing space in the end of the line. </p>
  
  <p>This is my Regular Expression tested on regexp.com </p>
  
  <pre><code>\b((\d{1,}[\s|\-]+){1,3}\d{1})\b
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/a2tZu.png" rel="nofollow noreferrer">enter image description here</a></p>
  
  <p>The Format I wanna capture are:</p>
  
  <pre><code>Format1- ####-#######-# 
  Format2- #### ####### #
  Format3- ##-#######-#
  Format4- ## ####### #
  Format5- ########## ({10,12} digits)
  </code></pre>