<?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: Search a pattern in a table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/search-a-pattern-in-a-table/m-p/7770982#M1584549</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you found an answer please put that here and close the thread.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 11 Apr 2011 21:48:01 GMT</pubDate>
    <dc:creator>former_member191735</dc:creator>
    <dc:date>2011-04-11T21:48:01Z</dc:date>
    <item>
      <title>Search a pattern in a table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/search-a-pattern-in-a-table/m-p/7770972#M1584539</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear REGEX gurus. &lt;/P&gt;&lt;P&gt;I have an internal table. I want to search for a pattern in it. &lt;/P&gt;&lt;P&gt;Simple example: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: lv_str TYPE string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA result_tab TYPE match_result_tab.&lt;/P&gt;&lt;P&gt;lv_str = '  testing regex pattern ' .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FIND ALL OCCURRENCES OF REGEX '&lt;STRONG&gt;tes&lt;/STRONG&gt;reg*' IN lv_str "IGNORING CASE&lt;/P&gt;&lt;P&gt;     RESULTS result_tab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;  WRITE: 'okay'.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;  WRITE: 'not okay'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if I put REGEX '*tes' -&amp;gt; I get syntax error. &lt;/P&gt;&lt;P&gt;If I remove it, my results are not correct - nothing is found, when there is a text - testing regex which matches ''tes&lt;STRONG&gt;reg&lt;/STRONG&gt;'. &lt;/P&gt;&lt;P&gt;What is going wrong here? &lt;/P&gt;&lt;P&gt;Basically I will make a pattern like this: concatenate '&lt;STRONG&gt;IT_DATA&lt;/STRONG&gt;' lv_num '*' into lv_pat. find all occurences of regex lv_pat in table lt_str ignoring case results ... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to make it work because putting * in front of pattern gives syntax error - but I want it as there may be leading spaces. &lt;/P&gt;&lt;P&gt;and anyway, this regex is not working for me &lt;SPAN __jive_emoticon_name="sad"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in adv.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Apr 2011 16:47:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/search-a-pattern-in-a-table/m-p/7770972#M1584539</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-04-07T16:47:42Z</dc:date>
    </item>
    <item>
      <title>Re: Search a pattern in a table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/search-a-pattern-in-a-table/m-p/7770973#M1584540</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The check of the regular expression "&lt;STRONG&gt;tes+reg&lt;/STRONG&gt;" resulted in an error in the&lt;/P&gt;&lt;P&gt;character offset 0. This could be caused by incorrect brackets, the&lt;/P&gt;&lt;P&gt;empty character sequence, or the use of an operator that is not&lt;/P&gt;&lt;P&gt;supported so far..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This should work if you change to &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FIND ALL OCCURRENCES OF REGEX 'tes+reg*'  IN lv_str&lt;/P&gt;&lt;P&gt;RESULTS result_tab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Remove * from first position. Check out the help for Valid regular expression and also for Character String Patterns.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Apr 2011 16:59:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/search-a-pattern-in-a-table/m-p/7770973#M1584540</guid>
      <dc:creator>former_member191735</dc:creator>
      <dc:date>2011-04-07T16:59:45Z</dc:date>
    </item>
    <item>
      <title>Re: Search a pattern in a table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/search-a-pattern-in-a-table/m-p/7770974#M1584541</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Sampath, but already tried that and it does not work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Apr 2011 17:11:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/search-a-pattern-in-a-table/m-p/7770974#M1584541</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-04-07T17:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: Search a pattern in a table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/search-a-pattern-in-a-table/m-p/7770975#M1584542</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;check the program DEMO_REGEX_TOY to find a regular expression you can use&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Apr 2011 17:16:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/search-a-pattern-in-a-table/m-p/7770975#M1584542</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-04-07T17:16:55Z</dc:date>
    </item>
    <item>
      <title>Re: Search a pattern in a table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/search-a-pattern-in-a-table/m-p/7770976#M1584543</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Sebastian. But I know of this program and I could not find any expression meeting my needs although it sounds so simple &lt;SPAN __jive_emoticon_name="sad"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Already tried for 2 hours.. I guess it would be a minute's job for a REGEX expert.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Apr 2011 17:30:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/search-a-pattern-in-a-table/m-p/7770976#M1584543</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-04-07T17:30:51Z</dc:date>
    </item>
    <item>
      <title>Re: Search a pattern in a table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/search-a-pattern-in-a-table/m-p/7770977#M1584544</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Then try the following.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FIND ALL OCCURRENCES OF REGEx '((tes)|(reg))' IN lv_str IGNORING CASE&lt;/P&gt;&lt;P&gt;RESULTS result_tab.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Apr 2011 17:49:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/search-a-pattern-in-a-table/m-p/7770977#M1584544</guid>
      <dc:creator>former_member191735</dc:creator>
      <dc:date>2011-04-07T17:49:32Z</dc:date>
    </item>
    <item>
      <title>Re: Search a pattern in a table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/search-a-pattern-in-a-table/m-p/7770978#M1584545</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Im not an expert either, but try replacing&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;FIND ALL OCCURRENCES OF REGEX '*tes*reg*' IN lv_str "IGNORING CASE&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;FIND ALL OCCURRENCES OF REGEX '.*tes.*reg.*' IN lv_str "IGNORING CASE&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;add a dot (.) before * &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this  [link|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/9222ea17-0a01-0010-4a85-a71ba4284b9d?quicklink=index&amp;amp;overridelayout=true] may help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edited: I think that regex that Sampath Kumar posted is better than add a dot&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Sebastian Bustamante on Apr 7, 2011 7:56 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Apr 2011 17:53:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/search-a-pattern-in-a-table/m-p/7770978#M1584545</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-04-07T17:53:10Z</dc:date>
    </item>
    <item>
      <title>Re: Search a pattern in a table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/search-a-pattern-in-a-table/m-p/7770979#M1584546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Sampath. But this one is an OR condition, right? It is giving incorrect results as if I remove Test, still it is working as REG word is there.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Apr 2011 17:58:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/search-a-pattern-in-a-table/m-p/7770979#M1584546</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-04-07T17:58:37Z</dc:date>
    </item>
    <item>
      <title>Re: Search a pattern in a table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/search-a-pattern-in-a-table/m-p/7770980#M1584547</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes it is a OR condition and it should work even if you remove 'tes' as you are using as a pattern. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are different type of Regular expressions. couple of them are &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Single Character strings and Character string patterns. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;are you looking for a pattern or exact match?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;by the way, you can use '^tes*' for space infornt of test.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Sampath Kumar on Apr 7, 2011 12:23 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Apr 2011 18:17:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/search-a-pattern-in-a-table/m-p/7770980#M1584547</guid>
      <dc:creator>former_member191735</dc:creator>
      <dc:date>2011-04-07T18:17:24Z</dc:date>
    </item>
    <item>
      <title>Re: Search a pattern in a table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/search-a-pattern-in-a-table/m-p/7770981#M1584548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;If nothing works, I think you can try with the patterns for comparing strings like CP.  In your case I guess CP will work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can refer this link for more details.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3516358411d1829f0000e829fbfe/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3516358411d1829f0000e829fbfe/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also for finding character strings, you can refer the below link.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb33cc358411d1829f0000e829fbfe/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb33cc358411d1829f0000e829fbfe/content.htm&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Apr 2011 04:35:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/search-a-pattern-in-a-table/m-p/7770981#M1584548</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-04-08T04:35:53Z</dc:date>
    </item>
    <item>
      <title>Re: Search a pattern in a table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/search-a-pattern-in-a-table/m-p/7770982#M1584549</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you found an answer please put that here and close the thread.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Apr 2011 21:48:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/search-a-pattern-in-a-table/m-p/7770982#M1584549</guid>
      <dc:creator>former_member191735</dc:creator>
      <dc:date>2011-04-11T21:48:01Z</dc:date>
    </item>
  </channel>
</rss>

