<?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: Stripping Text in Field Calculator using wildcard in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/stripping-text-in-field-calculator-using-wildcard/m-p/112259#M8740</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;You can try this as well:&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
text = "HITCH ENTERPRISES, INC. WARRANTY DEED BOOK 552, PAGE 532 (NW/4) (NE/4) (SE/4) OUT OF SECTION 29 TOWNSHIP 1N RANGE 16E TEXAS COUNTY, OKLAHOMA"
loc = text.find("OUT OF") #"OUT" works the same
print text[:loc]
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This is good.&amp;nbsp; How would I rework this to work with all items in field?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Maybe something similar to:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
def func():
text = !Label!
text.find("OUT OF")

print text[:loc]
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 06:42:49 GMT</pubDate>
    <dc:creator>NoahHuntington</dc:creator>
    <dc:date>2021-12-11T06:42:49Z</dc:date>
    <item>
      <title>Stripping Text in Field Calculator using wildcard</title>
      <link>https://community.esri.com/t5/python-questions/stripping-text-in-field-calculator-using-wildcard/m-p/112254#M8735</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is there anyway to strip text using wild card...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As in:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;HITCH ENTERPRISES, INC. WARRANTY DEED BOOK 552, PAGE 532 (NW/4) (NE/4) (SE/4)&amp;nbsp; OUT OF SECTION 29 TOWNSHIP 1N&amp;nbsp; RANGE 16E TEXAS COUNTY, OKLAHOMA&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Would like to remove anything after "OUT "&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;HITCH ENTERPRISES, INC. WARRANTY DEED BOOK 552, PAGE 532 (NW/4) (NE/4) (SE/4)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Would like to use "Out " as wildcard for strip function instead of string position as table attributes vary?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jan 2013 13:15:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/stripping-text-in-field-calculator-using-wildcard/m-p/112254#M8735</guid>
      <dc:creator>NoahHuntington</dc:creator>
      <dc:date>2013-01-24T13:15:39Z</dc:date>
    </item>
    <item>
      <title>Re: Stripping Text in Field Calculator using wildcard</title>
      <link>https://community.esri.com/t5/python-questions/stripping-text-in-field-calculator-using-wildcard/m-p/112255#M8736</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Something like this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
var = 'HITCH ENTERPRISES, INC. WARRANTY DEED BOOK 552, PAGE 532 (NW/4) (NE/4) (SE/4) OUT OF SECTION 29 TOWNSHIP 1N RANGE 16E TEXAS COUNTY, OKLAHOMA'
keepVar = var.split('OUT')[0]&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:42:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/stripping-text-in-field-calculator-using-wildcard/m-p/112255#M8736</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2021-12-11T06:42:44Z</dc:date>
    </item>
    <item>
      <title>Re: Stripping Text in Field Calculator using wildcard</title>
      <link>https://community.esri.com/t5/python-questions/stripping-text-in-field-calculator-using-wildcard/m-p/112256#M8737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sort of.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I need something that will work for a variety of instances in a field which all contain "OUT OF " a varying positions in the text...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;CLAWSON LAND PARTNERSHIP WARRANTY DEED BOOK 1069, PAGE 271 &amp;amp; BOOK 1061, PAGE 359 (E/2 OF NE/4) (SE/4)&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;OUT OF&lt;/SPAN&gt;&lt;SPAN&gt; SECTION 15 TOWNSHIP 1N&amp;nbsp; RANGE 16E TEXAS COUNTY, OKLAHOMA&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;or&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;HITCH ENTERPRISES, INC. WARRANTY DEED BOOK 552, PAGE 532 (W/2 OF NW/4)&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;OUT OF&lt;/SPAN&gt;&lt;SPAN&gt; SECTION 15 TOWNSHIP 1N&amp;nbsp; RANGE 16E TEXAS COUNTY, OKLAHOMA&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the response.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jan 2013 13:27:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/stripping-text-in-field-calculator-using-wildcard/m-p/112256#M8737</guid>
      <dc:creator>NoahHuntington</dc:creator>
      <dc:date>2013-01-24T13:27:17Z</dc:date>
    </item>
    <item>
      <title>Re: Stripping Text in Field Calculator using wildcard</title>
      <link>https://community.esri.com/t5/python-questions/stripping-text-in-field-calculator-using-wildcard/m-p/112257#M8738</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can try this as well:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
text = "HITCH ENTERPRISES, INC. WARRANTY DEED BOOK 552, PAGE 532 (NW/4) (NE/4) (SE/4) OUT OF SECTION 29 TOWNSHIP 1N RANGE 16E TEXAS COUNTY, OKLAHOMA"
loc = text.find("OUT OF") #"OUT" works the same
print text[:loc]
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:42:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/stripping-text-in-field-calculator-using-wildcard/m-p/112257#M8738</guid>
      <dc:creator>AndrewChapkowski</dc:creator>
      <dc:date>2021-12-11T06:42:46Z</dc:date>
    </item>
    <item>
      <title>Re: Stripping Text in Field Calculator using wildcard</title>
      <link>https://community.esri.com/t5/python-questions/stripping-text-in-field-calculator-using-wildcard/m-p/112258#M8739</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm confused. How does my example not work? You simply substitute var for whatever variable holds your field value.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jan 2013 13:41:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/stripping-text-in-field-calculator-using-wildcard/m-p/112258#M8739</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2013-01-24T13:41:55Z</dc:date>
    </item>
    <item>
      <title>Re: Stripping Text in Field Calculator using wildcard</title>
      <link>https://community.esri.com/t5/python-questions/stripping-text-in-field-calculator-using-wildcard/m-p/112259#M8740</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;You can try this as well:&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
text = "HITCH ENTERPRISES, INC. WARRANTY DEED BOOK 552, PAGE 532 (NW/4) (NE/4) (SE/4) OUT OF SECTION 29 TOWNSHIP 1N RANGE 16E TEXAS COUNTY, OKLAHOMA"
loc = text.find("OUT OF") #"OUT" works the same
print text[:loc]
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This is good.&amp;nbsp; How would I rework this to work with all items in field?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Maybe something similar to:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
def func():
text = !Label!
text.find("OUT OF")

print text[:loc]
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:42:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/stripping-text-in-field-calculator-using-wildcard/m-p/112259#M8740</guid>
      <dc:creator>NoahHuntington</dc:creator>
      <dc:date>2021-12-11T06:42:49Z</dc:date>
    </item>
    <item>
      <title>Re: Stripping Text in Field Calculator using wildcard</title>
      <link>https://community.esri.com/t5/python-questions/stripping-text-in-field-calculator-using-wildcard/m-p/112260#M8741</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I don't know what you mean by items in a field.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you have a cursor you can do something like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
with da.SearchCursor(&amp;lt;data&amp;gt;, [fields]) as cursor:
&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldValue = row[cursor.fields.index("fieldname")]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; startWord = row[cursor.fields.index("startWordField")] 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; stopWord = row[cursor.fields.index("stopWordField")]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; stop = fieldValue.find(stopWord)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; start = fieldValue.find(startWord)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print fieldValue[start:stop]

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I didn't test the code, but that's how you can break a string up by a start and stop position.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;For help with working with python standard types, please see: &lt;/SPAN&gt;&lt;A href="http://docs.python.org/2/library/stdtypes.html" rel="nofollow noopener noreferrer" target="_blank"&gt;http://docs.python.org/2/library/stdtypes.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:42:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/stripping-text-in-field-calculator-using-wildcard/m-p/112260#M8741</guid>
      <dc:creator>AndrewChapkowski</dc:creator>
      <dc:date>2021-12-11T06:42:52Z</dc:date>
    </item>
    <item>
      <title>Re: Stripping Text in Field Calculator using wildcard</title>
      <link>https://community.esri.com/t5/python-questions/stripping-text-in-field-calculator-using-wildcard/m-p/112261#M8742</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I'm confused. How does my example not work? You simply substitute var for whatever variable holds your field value.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You'll have to forgive me Matthew.&amp;nbsp; I am a little slow with all of this.&amp;nbsp; Would you be able to provide a screen cap of this used in field calculator?&amp;nbsp; I appreciate your input.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jan 2013 13:58:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/stripping-text-in-field-calculator-using-wildcard/m-p/112261#M8742</guid>
      <dc:creator>NoahHuntington</dc:creator>
      <dc:date>2013-01-24T13:58:29Z</dc:date>
    </item>
  </channel>
</rss>

