<?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: Regex checking with strings and numbers in Reporting</title>
    <link>https://community.splunk.com/t5/Reporting/Regex-checking-with-strings-and-numbers/m-p/553628#M9112</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/232004"&gt;@andres91302&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;you should try to use the eval command with match function, something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults | eval myfield="1234a1"
| append [ | makeresults | eval myfield="12341"]
| eval status=if(match(myfield,"[A-Z a-z]"),"yes","no")&lt;/LI-CODE&gt;&lt;P&gt;obviously applied to your real case.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Sat, 29 May 2021 15:14:37 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2021-05-29T15:14:37Z</dc:date>
    <item>
      <title>Regex checking with strings and numbers</title>
      <link>https://community.splunk.com/t5/Reporting/Regex-checking-with-strings-and-numbers/m-p/553624#M9111</link>
      <description>&lt;P&gt;Hello to you all guys&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to splunk regex I have been kind of bumping my head trying to do the following:&lt;BR /&gt;I need to validate if the value of a field is mad eup of only numbers... then I have to check that the length of this numbers is only equal to 4 and that this number starts with 0 kind of something like this:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;client hospital bed&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;only_numbers?&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;4_digits?&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;starts_with_0?&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;0458&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;YES&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;YES&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;YES&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;0845A8&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;NO&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;NO&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;NO&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The above result is the one that I want that I am looking for because if the vlue is not made out of numbers then.. I want the other two checks to be "NO"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="host_pnts_beds_ocup_ward_12_13"
| search beds_ocu=* AND ward IN ("12","12A","13B")
| rename beds_ocu as client_hospital_bed
| table client_hospital_bed&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you so much guys for your help! you people rock&lt;/P&gt;</description>
      <pubDate>Sat, 29 May 2021 14:59:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Regex-checking-with-strings-and-numbers/m-p/553624#M9111</guid>
      <dc:creator>andres91302</dc:creator>
      <dc:date>2021-05-29T14:59:46Z</dc:date>
    </item>
    <item>
      <title>Re: Regex checking with strings and numbers</title>
      <link>https://community.splunk.com/t5/Reporting/Regex-checking-with-strings-and-numbers/m-p/553628#M9112</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/232004"&gt;@andres91302&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;you should try to use the eval command with match function, something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults | eval myfield="1234a1"
| append [ | makeresults | eval myfield="12341"]
| eval status=if(match(myfield,"[A-Z a-z]"),"yes","no")&lt;/LI-CODE&gt;&lt;P&gt;obviously applied to your real case.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Sat, 29 May 2021 15:14:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Regex-checking-with-strings-and-numbers/m-p/553628#M9112</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2021-05-29T15:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: Regex checking with strings and numbers</title>
      <link>https://community.splunk.com/t5/Reporting/Regex-checking-with-strings-and-numbers/m-p/553630#M9114</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/232004"&gt;@andres91302&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please try this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;YOUR_SEARCH
| eval only_numbers=if(isnull(tonumber(client_hospital_bed)),"No","Yes"), 4_digits=if(len(client_hospital_bed)==4,"Yes","No"),starts_with_0=if(substr(client_hospital_bed,0,1)=="0","Yes","No")
| table client_hospital_bed only_numbers 4_digits starts_with_0&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;My Sample Search :&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval client_hospital_bed="0458|0845A8", client_hospital_bed=split(client_hospital_bed,"|") 
| mvexpand client_hospital_bed
|rename comment as "Upto Now is sample data only"
| eval only_numbers=if(isnull(tonumber(client_hospital_bed)),"No","Yes"), 4_digits=if(len(client_hospital_bed)==4,"Yes","No"),starts_with_0=if(substr(client_hospital_bed,0,1)=="0","Yes","No")
| table client_hospital_bed only_numbers 4_digits starts_with_0&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;BR /&gt;KV&lt;BR /&gt;▄︻̷̿┻̿═━一&lt;BR /&gt;&lt;BR /&gt;If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.&lt;/P&gt;</description>
      <pubDate>Sat, 29 May 2021 15:20:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Regex-checking-with-strings-and-numbers/m-p/553630#M9114</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2021-05-29T15:20:28Z</dc:date>
    </item>
  </channel>
</rss>

