title: Regex negative value with spaces between negative signal and number
body: <p>I have a readout from a balance which reads like this:</p>
  <p><code>G     -  3.56436  mg</code></p>
  <p>I need to use regex (required by application) to provide the numeric value to be later on registered within the application. I am using the following regex with success to some different balance models.</p>
  <p><code>(?&lt;= )(?&lt;Value&gt;[-\d\.]*)\s*(?&lt;Unit&gt;[\w]*)\s*$</code></p>
  <p>Group called 'value' is responsible for capturing the numerical value, and group called 'unit' captures the measurement unit (in milligrams on the example provided).</p>
  <p>The challenge I have is, using the regex provided above, because of the two spaces between the &quot;-&quot; and the numerical value, the regex is not capturing the negative symbol as needed, and every attempt to capture the negative symbol I tried so far led me to capture the &quot;-&quot; and the number as separate matches.</p>
  <p>What I needed my match to show up was one match equal to &quot;-3.56436&quot;, with no spaces between the negative symbol and the number.</p>
  <p>I tried taking a look at some options like lookaround, but had no success so far. The closest I got was to report the negative and numeric value on the same match, but it also captured all spaces along with it. Here is the regex that led to this outcome (same as previous one, with addition of &quot;\s&quot; on value group).</p>
  <p><code>(?&lt;= )(?&lt;Value&gt;[-\d\.\s]*)\s*(?&lt;Unit&gt;[\w]*)\s*$</code></p>
  <p>Is this even technically possible using regex alone? Am I asking too much of it and I would need to rethink my strategy?</p>
  <p>First post on Stack Overflow, so completely newbie at doing this. Please be patient at the low level of technical expertise.</p>