<?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: How to drop all digits from string with exceptions using Regex? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-drop-all-digits-from-string-with-exceptions-using-Regex/m-p/303753#M56051</link>
    <description>&lt;P&gt;Try using negative lookahead:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Phrase = "14.300.114 .temperature is not 120f but 119 f...";
Show( Phrase );

result = Regex( Phrase, "(?!\d+\s*f)\d+", "", GLOBALREPLACE );
Show( result);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Output:&lt;/P&gt;
&lt;P&gt;Phrase = "14.300.114 .temperature is not 120f but 119 f...";&lt;BR /&gt;result = ".. .temperature is not 120f but 119 f...";&lt;/P&gt;</description>
    <pubDate>Wed, 09 Sep 2020 19:23:27 GMT</pubDate>
    <dc:creator>paul_vezzetti</dc:creator>
    <dc:date>2020-09-09T19:23:27Z</dc:date>
    <item>
      <title>How to drop all digits from string with exceptions using Regex?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-drop-all-digits-from-string-with-exceptions-using-Regex/m-p/303665#M56043</link>
      <description>&lt;P&gt;I want to clean up a free text filed column for text analysis and am trying to drop all digits except when followed by a specific letter. In the example below, I want to drop the first numbers but keep both 120f and 119 f, as they are meaningful values.&lt;/P&gt;&lt;P&gt;Using the following regex:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Phrase =
"14.300.114 .temperature is not 120f but 119 f...";
Show( Phrase );

Regex( Phrase, "\d+([^\d+(f|\sf)])", "", GLOBALREPLACE );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;gives me this result:&lt;/P&gt;&lt;P&gt;"114 .temperature is not 120f but 119 f...". The remperatures are succesfully kept, but not all digits from the first digit string are droppped.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My first iteration looked like this:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Regex( Phrase, "\d+([^\d+f])", "", GLOBALREPLACE );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;which resulted in :&lt;/P&gt;&lt;P&gt;".temperature is not 120f but f..."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So this was successful at removing all digits, but is not keeping the "119 f" case (with the space between the number and the "f").&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone help me understand how to build the expression that correctly drops all digits except when followed by "f" or by " f"?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 23:37:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-drop-all-digits-from-string-with-exceptions-using-Regex/m-p/303665#M56043</guid>
      <dc:creator>Mo</dc:creator>
      <dc:date>2023-06-09T23:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to drop all digits from string with exceptions using Regex?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-drop-all-digits-from-string-with-exceptions-using-Regex/m-p/303753#M56051</link>
      <description>&lt;P&gt;Try using negative lookahead:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Phrase = "14.300.114 .temperature is not 120f but 119 f...";
Show( Phrase );

result = Regex( Phrase, "(?!\d+\s*f)\d+", "", GLOBALREPLACE );
Show( result);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Output:&lt;/P&gt;
&lt;P&gt;Phrase = "14.300.114 .temperature is not 120f but 119 f...";&lt;BR /&gt;result = ".. .temperature is not 120f but 119 f...";&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 19:23:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-drop-all-digits-from-string-with-exceptions-using-Regex/m-p/303753#M56051</guid>
      <dc:creator>paul_vezzetti</dc:creator>
      <dc:date>2020-09-09T19:23:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to drop all digits from string with exceptions using Regex?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-drop-all-digits-from-string-with-exceptions-using-Regex/m-p/303756#M56054</link>
      <description>Thank you, that worked!</description>
      <pubDate>Wed, 09 Sep 2020 20:15:33 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-drop-all-digits-from-string-with-exceptions-using-Regex/m-p/303756#M56054</guid>
      <dc:creator>Mo</dc:creator>
      <dc:date>2020-09-09T20:15:33Z</dc:date>
    </item>
  </channel>
</rss>

