<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Regexp function to extract numbers</title><link>https://community.appian.com/discussions/f/user-interface/11583/regexp-function-to-extract-numbers</link><description>Hello, 
 Does Appian have any inbuilt function to extract numbers only from a text string? 
 Eg: If the string field is &amp;quot;ABC 123&amp;quot; then how to get the value of 123 
 
 Thanks, 
 Rohit</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Regexp function to extract numbers</title><link>https://community.appian.com/thread/82153?ContentTypeID=1</link><pubDate>Fri, 28 May 2021 12:31:51 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:923e07c1-9bff-4615-90b3-609e6e64578b</guid><dc:creator>claraf0002</dc:creator><description>&lt;p&gt;How about if I want to return a 7digit value , but i do not know the exact value?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Regexp function to extract numbers</title><link>https://community.appian.com/thread/52677?ContentTypeID=1</link><pubDate>Thu, 15 Feb 2018 13:41:07 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:601fa830-904e-4dcd-873f-f2432135631c</guid><dc:creator>PhilB</dc:creator><description>&lt;p&gt;A lot of these examples appear to show a fundamental misunderstanding of regex. If you&amp;#39;d like to do this using regex, you can use:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;fn!regexallmatches(
  &amp;quot;[0-9]+&amp;quot;,
  &amp;quot;ABC 123&amp;quot;
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Note that you&amp;#39;ll have to choose between&amp;nbsp;fn!regexallmatches and&amp;nbsp;fn!regexfirstmatch depending on your data; the former returns a list of matches and the latter returns only the first match.&lt;/p&gt;
&lt;p&gt;If you&amp;#39;d like to see and/or test regexes, &lt;a href="https://regexr.com/3krl2"&gt;this tool&lt;/a&gt; is an excellent option and (as per the link) allows you to share and test regexes.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Regexp function to extract numbers</title><link>https://community.appian.com/thread/52676?ContentTypeID=1</link><pubDate>Thu, 15 Feb 2018 13:30:54 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:3682af5d-53b2-4773-bd23-3e8af213eb3a</guid><dc:creator>Amit Mishra</dc:creator><description>Regexp will not work if you are not looking for a specific pattern. If a specific pattern then yes, use Regexp.&lt;br /&gt;
There are many way to find integer value, as suggested by others. You can also try  comparing with index of each element of your string/array. Choice should yours but based on your code performance. Thanks&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Regexp function to extract numbers</title><link>https://community.appian.com/thread/52217?ContentTypeID=1</link><pubDate>Fri, 02 Feb 2018 12:10:11 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6891f930-7e3c-4135-8cf0-aa7103255ef3</guid><dc:creator>swarajd0001</dc:creator><description>In appian ,if you take a text field in interface,number integer as rule input . then you will get only numeric values from String .&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Regexp function to extract numbers</title><link>https://community.appian.com/thread/51721?ContentTypeID=1</link><pubDate>Fri, 12 Jan 2018 21:26:09 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:40dce341-2cc4-4081-b5be-05c25d63b66a</guid><dc:creator>jayakumars</dc:creator><description>This is a clever solution.  Thanks!&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Regexp function to extract numbers</title><link>https://community.appian.com/thread/51033?ContentTypeID=1</link><pubDate>Wed, 20 Dec 2017 21:22:34 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d91c62a5-f288-46db-a4cf-e4c9a2919109</guid><dc:creator>aloks0189</dc:creator><description>Hi &lt;a href="/members/rohita187"&gt;bpmnewb&lt;/a&gt; i believe cleanwith(..., ....) function is the best option here for your case, because of following reasons:&lt;br /&gt;
&lt;br /&gt;
1. When you use tointeger(...) text will be converted to their respective Integer, but when you have some special characters, it will return null as it&amp;#39;s response. For example: tointeger(&amp;quot;a.@1apllr2-_3,,.../ab&amp;quot;)    -&amp;gt; Returns -&amp;gt; null&lt;br /&gt;
&lt;br /&gt;
2. When you go for regexallmatches() you have similar kind of issues and in order to resolve that, you need to make the use of wildcard characters/escape sequence syntax. Below code snippet show the problem with regexallmatches() &lt;br /&gt;
&lt;br /&gt;
load(&lt;br /&gt;
local!string:&amp;quot;a.@1apllr2-_3,,.../ab&amp;quot;,&lt;br /&gt;
regexallmatches( &lt;br /&gt;
&amp;quot;1234567890&amp;quot;,&lt;br /&gt;
local!string&lt;br /&gt;
)&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
Hence i recommend better to go for cleanwith(..., ....) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Hope it will help you to choose the best option for your scenario.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Regexp function to extract numbers</title><link>https://community.appian.com/thread/51000?ContentTypeID=1</link><pubDate>Wed, 20 Dec 2017 09:17:38 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:026c1ca8-2ea4-4e47-8cd9-11e4aec2ef29</guid><dc:creator>shwetap</dc:creator><description>hey Rohita187,&lt;br /&gt;
you can try this.&lt;br /&gt;
load(&lt;br /&gt;
local!numbers:regexallmatches(&amp;quot;[0-9]&amp;quot;,&amp;quot;asd12&amp;quot;),&lt;br /&gt;
{&lt;br /&gt;
  local!value:concat(local!numbers)&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
)&lt;br /&gt;
thanks,&lt;br /&gt;
shweta p.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Regexp function to extract numbers</title><link>https://community.appian.com/thread/50999?ContentTypeID=1</link><pubDate>Wed, 20 Dec 2017 09:09:58 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:3d31c3a5-a8d9-43de-ae5b-37cfa943a916</guid><dc:creator>Mainak Chanda</dc:creator><description>It can also be done using the Regex function:&lt;br /&gt;
&lt;br /&gt;
load(&lt;br /&gt;
  local!string:&amp;quot;ABC 123&amp;quot;,&lt;br /&gt;
regexallmatches(        &lt;br /&gt;
  &amp;quot;123&amp;quot;,&lt;br /&gt;
  local!string&lt;br /&gt;
)&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But Regex function is mainly used for complex patterns where pattern may include characters , numbers and even special characters.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Regexp function to extract numbers</title><link>https://community.appian.com/thread/50992?ContentTypeID=1</link><pubDate>Wed, 20 Dec 2017 06:00:18 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f4e80e17-43a3-4161-94bd-cdd856039136</guid><dc:creator>amanit</dc:creator><description>You can try using Appian inbuilt function cleanwith(ri!targetText, &amp;quot;1234567890&amp;quot;), which strips out alphabets and returns only numbers in return.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Regexp function to extract numbers</title><link>https://community.appian.com/thread/50991?ContentTypeID=1</link><pubDate>Wed, 20 Dec 2017 05:54:56 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:93884bfc-05f4-4e36-8654-3bfd8c1d4f1b</guid><dc:creator>Jayapriya Muthu</dc:creator><description>Hi,&lt;br /&gt;
tointeger() function will try to convert the string to integer and it will strips the non-digits&lt;br /&gt;
ex. tointeger(&amp;quot;ABC 123&amp;quot;) will return output as 123 as you asked.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>