<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Replace string with values in a new field column ? in Data Management Questions</title>
    <link>https://community.esri.com/t5/data-management-questions/replace-string-with-values-in-a-new-field-column/m-p/238637#M13564</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Where exactly is the number in "MOR-Q"? Does this have what you call a number, or is there no number for this one?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 19 Jan 2016 23:54:46 GMT</pubDate>
    <dc:creator>DarrenWiens2</dc:creator>
    <dc:date>2016-01-19T23:54:46Z</dc:date>
    <item>
      <title>Replace string with values in a new field column ?</title>
      <link>https://community.esri.com/t5/data-management-questions/replace-string-with-values-in-a-new-field-column/m-p/238635#M13562</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a Forest roads here with me and there is a column (iD ) that shows street name number, freeway, state, county along with their numbers..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I copied them to a new field column Symbol that I need to calculate them with just numbers only.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This purpose is to show them the road symbol number as a labels &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I do that&amp;nbsp; in the Field Calculator ?&lt;IMG alt="ID.png" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/170828_ID.png" style="width: auto; height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jan 2016 20:41:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/replace-string-with-values-in-a-new-field-column/m-p/238635#M13562</guid>
      <dc:creator>DEAF_PROBERT_68</dc:creator>
      <dc:date>2016-01-19T20:41:16Z</dc:date>
    </item>
    <item>
      <title>Re: Replace string with values in a new field column ?</title>
      <link>https://community.esri.com/t5/data-management-questions/replace-string-with-values-in-a-new-field-column/m-p/238636#M13563</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;as I suggested before&lt;/P&gt;&lt;P&gt;python of course&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; a ="83N"&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; b = "".join([i for i in a if i in '0123456789'])&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; b&lt;/P&gt;&lt;P&gt;'83'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where 'a' is !yourfield!&lt;/P&gt;&lt;P&gt;where a is your field and b will be your new field which you don't have to specify.&amp;nbsp; This could be used directly in the field calculator&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AND&lt;/P&gt;&lt;P&gt;it will not work in all cases as I stated before since I doubt that highway 360.2B is going to come out as 360.2 but 3602.&lt;/P&gt;&lt;P&gt;multiple steps may be necessary. &lt;/P&gt;&lt;P&gt;If you want a numeric value, wrap the whole thing in an int( ) statement&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jan 2016 20:49:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/replace-string-with-values-in-a-new-field-column/m-p/238636#M13563</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-01-19T20:49:34Z</dc:date>
    </item>
    <item>
      <title>Re: Replace string with values in a new field column ?</title>
      <link>https://community.esri.com/t5/data-management-questions/replace-string-with-values-in-a-new-field-column/m-p/238637#M13564</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Where exactly is the number in "MOR-Q"? Does this have what you call a number, or is there no number for this one?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jan 2016 23:54:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/replace-string-with-values-in-a-new-field-column/m-p/238637#M13564</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2016-01-19T23:54:46Z</dc:date>
    </item>
    <item>
      <title>Re: Replace string with values in a new field column ?</title>
      <link>https://community.esri.com/t5/data-management-questions/replace-string-with-values-in-a-new-field-column/m-p/238638#M13565</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can account for it... but it is getting less elegant &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; a = "MOR-Q"
&amp;gt;&amp;gt;&amp;gt; b = "".join([i for i in a if i in '0123456789'])
&amp;gt;&amp;gt;&amp;gt; b
''&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or for the devil's highway in nodata form&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; b = ["".join([i for i in a if i in '0123456789']) or -666][0]
&amp;gt;&amp;gt;&amp;gt; b
-666&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:00:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/replace-string-with-values-in-a-new-field-column/m-p/238638#M13565</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T12:00:48Z</dc:date>
    </item>
    <item>
      <title>Re: Replace string with values in a new field column ?</title>
      <link>https://community.esri.com/t5/data-management-questions/replace-string-with-values-in-a-new-field-column/m-p/238639#M13566</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Wait, Dan, what happened to the smoking one-liner (of code)?&amp;nbsp; &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/wink.png" /&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(just kidding)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chris Donohue, GISP&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jan 2016 02:18:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/replace-string-with-values-in-a-new-field-column/m-p/238639#M13566</guid>
      <dc:creator>ChrisDonohue__GISP</dc:creator>
      <dc:date>2016-01-20T02:18:29Z</dc:date>
    </item>
    <item>
      <title>Re: Replace string with values in a new field column ?</title>
      <link>https://community.esri.com/t5/data-management-questions/replace-string-with-values-in-a-new-field-column/m-p/238640#M13567</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are probably some in the long history of this question...&amp;nbsp; &lt;A href="https://community.esri.com/thread/170951"&gt;How do you write expression in Label field to replace string with values ?&lt;/A&gt;&amp;nbsp; Nothing seems to work, I think the questions are asked and forgotten.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jan 2016 03:45:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/replace-string-with-values-in-a-new-field-column/m-p/238640#M13567</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-01-20T03:45:50Z</dc:date>
    </item>
    <item>
      <title>Re: Replace string with values in a new field column ?</title>
      <link>https://community.esri.com/t5/data-management-questions/replace-string-with-values-in-a-new-field-column/m-p/238641#M13568</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried and didn't work either and I was wondering if that had to do with the new version each time ESRI upgraded their ESRI products and we all have to re-learn new things&amp;nbsp; and that is CRAZY !!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jan 2016 15:33:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/replace-string-with-values-in-a-new-field-column/m-p/238641#M13568</guid>
      <dc:creator>DEAF_PROBERT_68</dc:creator>
      <dc:date>2016-01-20T15:33:18Z</dc:date>
    </item>
    <item>
      <title>Re: Replace string with values in a new field column ?</title>
      <link>https://community.esri.com/t5/data-management-questions/replace-string-with-values-in-a-new-field-column/m-p/238642#M13569</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;Sorry -- I just could not resist ..... Temptation got the better of me!&amp;nbsp; &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif;"&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;int&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;filter&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;str&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;isdigit&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; [ID]&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;))&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;BTW:&amp;nbsp; I had an access denied when trying to use the advanced editor....&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jan 2016 15:54:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/replace-string-with-values-in-a-new-field-column/m-p/238642#M13569</guid>
      <dc:creator>TedKowal</dc:creator>
      <dc:date>2016-01-20T15:54:38Z</dc:date>
    </item>
    <item>
      <title>Re: Replace string with values in a new field column ?</title>
      <link>https://community.esri.com/t5/data-management-questions/replace-string-with-values-in-a-new-field-column/m-p/238643#M13570</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; a = "MIA-45.678"&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; b = float(''.join(ele for ele in a if ele.isdigit() or ele == '.'))&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; b&lt;/P&gt;&lt;P&gt;45.678&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jan 2016 16:04:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/replace-string-with-values-in-a-new-field-column/m-p/238643#M13570</guid>
      <dc:creator>TedKowal</dc:creator>
      <dc:date>2016-01-20T16:04:28Z</dc:date>
    </item>
    <item>
      <title>Re: Replace string with values in a new field column ?</title>
      <link>https://community.esri.com/t5/data-management-questions/replace-string-with-values-in-a-new-field-column/m-p/238644#M13571</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;trying to cut down on filter, map and lambda... beginning to forget their usefulness&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jan 2016 16:13:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/replace-string-with-values-in-a-new-field-column/m-p/238644#M13571</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-01-20T16:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: Replace string with values in a new field column ?</title>
      <link>https://community.esri.com/t5/data-management-questions/replace-string-with-values-in-a-new-field-column/m-p/238645#M13572</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are using the python parser aren't you?&amp;nbsp; Arc* defaults to vb-whatever and you can't set python as the default.&amp;nbsp; Eventually, they will get it fixed.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jan 2016 16:21:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/replace-string-with-values-in-a-new-field-column/m-p/238645#M13572</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-01-20T16:21:31Z</dc:date>
    </item>
    <item>
      <title>Re: Replace string with values in a new field column ?</title>
      <link>https://community.esri.com/t5/data-management-questions/replace-string-with-values-in-a-new-field-column/m-p/238646#M13573</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just curious - any idea if the suggestion of allowing the setting of the default to Python (instead of VB script) has been submitted to ESRI already as an enhancement?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chris Donohue, GISP&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jan 2016 16:31:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/replace-string-with-values-in-a-new-field-column/m-p/238646#M13573</guid>
      <dc:creator>ChrisDonohue__GISP</dc:creator>
      <dc:date>2016-01-20T16:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: Replace string with values in a new field column ?</title>
      <link>https://community.esri.com/t5/data-management-questions/replace-string-with-values-in-a-new-field-column/m-p/238647#M13574</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;quite some time ago... so long ago, that I can't find it&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jan 2016 16:38:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/replace-string-with-values-in-a-new-field-column/m-p/238647#M13574</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-01-20T16:38:32Z</dc:date>
    </item>
    <item>
      <title>Re: Replace string with values in a new field column ?</title>
      <link>https://community.esri.com/t5/data-management-questions/replace-string-with-values-in-a-new-field-column/m-p/238648#M13575</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;VBScript or Python ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tried and gave me the error&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jan 2016 18:44:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/replace-string-with-values-in-a-new-field-column/m-p/238648#M13575</guid>
      <dc:creator>DEAF_PROBERT_68</dc:creator>
      <dc:date>2016-01-20T18:44:56Z</dc:date>
    </item>
    <item>
      <title>Re: Replace string with values in a new field column ?</title>
      <link>https://community.esri.com/t5/data-management-questions/replace-string-with-values-in-a-new-field-column/m-p/238649#M13576</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you want to try vbscript:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;int([ID])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course those string with no numbers will come out to be 0.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jan 2016 21:05:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/replace-string-with-values-in-a-new-field-column/m-p/238649#M13576</guid>
      <dc:creator>TedKowal</dc:creator>
      <dc:date>2016-01-20T21:05:54Z</dc:date>
    </item>
    <item>
      <title>Re: Replace string with values in a new field column ?</title>
      <link>https://community.esri.com/t5/data-management-questions/replace-string-with-values-in-a-new-field-column/m-p/238650#M13577</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Robert,&lt;/P&gt;&lt;P&gt;If I understand your situation correctly &lt;STRONG&gt;and&lt;/STRONG&gt; you want to take a &lt;STRONG&gt;non-script approach&lt;/STRONG&gt; I think you could do that fairly easily with some preprocessing to separate out the "pure" numbers (e.g., "111" in your snapshot) from the "mixed format" numbers (e.g., "PRK-70").&amp;nbsp; The "pure" ones are a piece of cake; just add your new numeric field and use the Field Calculator to copy in the numbers.&amp;nbsp; If they were all "pure" you'd be done; but, alas, they aren't.&amp;nbsp; So, for these you can use an intermediate text field, some selection sets and VBA functions (e.g., RIGHT).&amp;nbsp; Don't see what you intend to do with the ones that don't have any number in them except leave them 0.&amp;nbsp; Of course, you may want to create a text Symbol field that just leaves off the state, county and other values embedded in your ID field.&amp;nbsp; If you expect to do this repeatedly or want to practice scripting, you should definitely go the script route, but if it's a one-off thing and you just want it done, the VBA process should work just fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check out this Knowledge Base Technical Article for VBA functions.&amp;nbsp; I'm using ArcGIS 10.3 and they still work for me.&amp;nbsp; Good luck.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.esri.com/en/knowledgebase/techarticles/detail/31807" title="http://support.esri.com/en/knowledgebase/techarticles/detail/31807"&gt;31807 - Use VBA functions in the Field Calculator&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jan 2016 15:17:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/replace-string-with-values-in-a-new-field-column/m-p/238650#M13577</guid>
      <dc:creator>katherinehannaford</dc:creator>
      <dc:date>2016-01-25T15:17:05Z</dc:date>
    </item>
  </channel>
</rss>

