title: How to use regex to match some words if they exist (if not match others left as well)
body: <p>For example, 
  the string is:</p>
  
  <pre><code>"0x0:dqwdq0x1:dqwd0x2-0x3:sdqwd"
  </code></pre>
  
  <p>How do I match the following: </p>
  
  <pre><code>['0x0:', '0x1:', '0x2-0x3:'] 
  </code></pre>
  
  <p>in regex, or better, use re module in python? In most cases the patterns will be in 0x[0-9] but the thing is sometimes there would have an extra piece: -0x[0-9] in the string. Thanks for help!</p>