Field Calculator help - just how numbers

Discussion created by sjacksonesriaustralia-com-au-esridist Employee on Apr 29, 2014
Latest reply on Apr 29, 2014 by rsunderman-esristaff
I have an incoming event definition which has a site name. 
This is the output from a TCP output connector:

Received Event : HITS,210142-US Kewell Ck,30/04/2014 00:15:00,0.672,0.0,á,á,á
Received Event : HITS,210137-Wangat,29/04/2014 23:00:00,0.268,18.0,á,15.5,á

In my featureclass, I only have a siteID, so for the above two, it would be 210142 and 210137.
This is always a 6 digit number.

Therefore, I figured this would be a good example of how a field calculator would be able to either

  1. Trim the string to just show the first 6 characters

  2. Strip the string down to just show numbers (using regex)

I decided to go for the second option.


However, this just returns empty values:

Received Event : HITS,,29/04/2014 23:30:00,0.356,13.7,á,á,á
Received Event : HITS,,29/04/2014 23:45:00,0.668,42.520,á,á,á

I have tried various alternatives to the regex pattern, but it always gives blank values.  Is this because the incoming event is a string and therefore there is no numbers? 

So, in priority order:

  1. How would you solve this with approach #2

  2. How would you solve it with approach #1

  3. Bonus points for helping me convert those incoming blank values which are coming in from the input feed as \u00a0 and ending up being á.  Not sure what happens when I throw these at a double field in my feature class, might not matter.