Question

Filter data

  • 3 December 2018
  • 2 replies
  • 10 views

I have a esri feature class, and one of the columns (populations) contains values in different formats, all in text (1234 | 1,234 | 123 txt | 12 txt. 34 | <Null>).

I want all the values in a new integer field.

Is there anyone who can help me to get rid of the text and (1234).


2 replies

Userlevel 4

Try a StringReplacer in regular expression mode. Text to replace:

 ^([0-9,]+)

Replacement text:

\1

This will leave only the first digits + commas at the start of the attribute.

0684Q00000ArLIwQAN.png

If you want to get rid of the comma you can use a second StringReplacer and leave the Replacement text empty:

0684Q00000ArLHXQA3.png

Userlevel 5
Badge +25

I think a StringReplacer with this regex:

\(.+\)|\D

should do the trick. Replace the matches with nothing and you should be left with all digits as long as they're not between ()

Essentially the same as @david_r suggests, but in one go.

Reply