<?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: remove string that contains number from text in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/remove-string-that-contains-number-from-text/m-p/723612#M90568</link>
    <description>&lt;P&gt;Not sure i this would work in all situations but it does for these examples&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

strs = {
"I ate 4 apples and 2 bananas",
"the model number is 0998GBELS",
"03/45 is the ratio to check"
};

result2 = Transform Each({str}, strs,
	Regex(str, "\w*\S*\d+\w*\S*", "", GLOBALREPLACE)
);

show(result2);&amp;nbsp;//&amp;nbsp;result2 = {"I ate apples and bananas", "the model number is ", " is the ratio to check"};&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Edit:&lt;/P&gt;
&lt;P&gt;I think that regex can be simplified a bit to&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Regex(str, "\S*\d+\S*", "", GLOBALREPLACE)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;A href="https://regex101.com/r/PM4UQn/1" target="_self"&gt;https://regex101.com/r/PM4UQn/1&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 10 Feb 2024 17:07:49 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2024-02-10T17:07:49Z</dc:date>
    <item>
      <title>remove string that contains number from text</title>
      <link>https://community.jmp.com/t5/Discussions/remove-string-that-contains-number-from-text/m-p/723579#M90564</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&amp;nbsp;is that a way to remove any string that contain numbers using JSL?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&lt;BR /&gt;I ate &lt;STRONG&gt;4&lt;/STRONG&gt; apples and &lt;STRONG&gt;2&lt;/STRONG&gt; bananas&lt;BR /&gt;the model number is &lt;STRONG&gt;0998GBELS&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;03/45&lt;/STRONG&gt; is the ratio to check&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Targeted Output:&lt;/P&gt;&lt;P&gt;I ate apples and bananas&lt;BR /&gt;the model number is&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;is the ratio to check&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Feb 2024 03:51:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/remove-string-that-contains-number-from-text/m-p/723579#M90564</guid>
      <dc:creator>dadawasozo</dc:creator>
      <dc:date>2024-02-10T03:51:14Z</dc:date>
    </item>
    <item>
      <title>Re: remove string that contains number from text</title>
      <link>https://community.jmp.com/t5/Discussions/remove-string-that-contains-number-from-text/m-p/723591#M90566</link>
      <description>&lt;P&gt;This works, but someone familiar with Regular Expressions would be able to simplify the script&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
theString = "I ate 4 apples and 2 bananas
the model number is 0998GBELS

03/45 is the ratio to check";

theList = Words( theString, " \!n\!r\!t" );
adjustedString = "";
For Each( {member}, theList,
	Show( member );
//member=thelist[1]
	found = "No";
	If( !Contains( member, "0" ),
		If( !Contains( member, "1" ),
			If( !Contains( member, "2" ),
				If( !Contains( member, "3" ),
					If( !Contains( member, "4" ),
						If( !Contains( member, "5" ),
							If( !Contains( member, "6" ),
								If( !Contains( member, "7" ),
									If( !Contains( member, "8" ),
										If( !Contains( member, "9" ),
											adjustedString = Trim( adjustedString || " " || member )
										)
									)
								)
							)
						)
					)
				)
			)
		)
	);
);

Show( adjusted String );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Feb 2024 05:38:33 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/remove-string-that-contains-number-from-text/m-p/723591#M90566</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-02-10T05:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: remove string that contains number from text</title>
      <link>https://community.jmp.com/t5/Discussions/remove-string-that-contains-number-from-text/m-p/723611#M90567</link>
      <description>&lt;P&gt;I have many lines to process (in hundred millions), doing so will cause higher latency. I wonder if there is a better way to remove those strings that contain number with lower latency ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Feb 2024 15:52:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/remove-string-that-contains-number-from-text/m-p/723611#M90567</guid>
      <dc:creator>dadawasozo</dc:creator>
      <dc:date>2024-02-10T15:52:43Z</dc:date>
    </item>
    <item>
      <title>Re: remove string that contains number from text</title>
      <link>https://community.jmp.com/t5/Discussions/remove-string-that-contains-number-from-text/m-p/723612#M90568</link>
      <description>&lt;P&gt;Not sure i this would work in all situations but it does for these examples&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

strs = {
"I ate 4 apples and 2 bananas",
"the model number is 0998GBELS",
"03/45 is the ratio to check"
};

result2 = Transform Each({str}, strs,
	Regex(str, "\w*\S*\d+\w*\S*", "", GLOBALREPLACE)
);

show(result2);&amp;nbsp;//&amp;nbsp;result2 = {"I ate apples and bananas", "the model number is ", " is the ratio to check"};&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Edit:&lt;/P&gt;
&lt;P&gt;I think that regex can be simplified a bit to&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Regex(str, "\S*\d+\S*", "", GLOBALREPLACE)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;A href="https://regex101.com/r/PM4UQn/1" target="_self"&gt;https://regex101.com/r/PM4UQn/1&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Feb 2024 17:07:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/remove-string-that-contains-number-from-text/m-p/723612#M90568</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-02-10T17:07:49Z</dc:date>
    </item>
  </channel>
</rss>

