<?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: Pattern recognition in a given string in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465306#M1650799</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT z_test.
*--------------------------------------------------------------------*
TYPES: BEGIN OF ty_result_out,
         search_string TYPE string,
         offset        TYPE match_result-offset,
         length        TYPE match_result-length,
       END OF ty_result_out.
DATA: tp_string        TYPE string VALUE '1121112211',
      tp_string_copy   TYPE string,
      tp_real_offset   TYPE i,
      ltp_strlen       TYPE i,
      wa_search_str    TYPE string,
      wa_result        TYPE match_result,
      tp_dummy         TYPE string,
      ta_result_out    TYPE TABLE OF ty_result_out,
      wa_result_out    TYPE ty_result_out,
      ta_searchstrings TYPE STANDARD TABLE OF string,
      wa_searchstring  TYPE string,
      ltp_size         TYPE i,
      ltp_pos          TYPE i,
      ltp_check        TYPE i.
* References For ALV
DATA: rf_table        TYPE REF TO cl_salv_table,
      rf_functions    TYPE REF TO cl_salv_functions_list,
      rf_columns      TYPE REF TO cl_salv_columns_table,
      rf_column       TYPE REF TO cl_salv_column_table,
      rf_display      TYPE REF TO cl_salv_display_settings,
      tp_title        TYPE lvc_title.
* Determine the length of the string:
ltp_strlen = STRLEN( tp_string ).
* Get all possible search strings
DO ltp_strlen TIMES.
  ltp_size = sy-index.
  DO ltp_strlen TIMES.
    ltp_pos = sy-index - 1.
    ltp_check = ltp_pos + ltp_size.
    IF  ltp_check &amp;gt; ltp_strlen.
      EXIT.
    ELSE.
      wa_searchstring = tp_string+ltp_pos(ltp_size).
      APPEND wa_searchstring TO ta_searchstrings.
    ENDIF.
  ENDDO.
ENDDO.
SORT ta_searchstrings. DELETE ADJACENT DUPLICATES FROM ta_searchstrings.
TRY.
* Search for each possible search string:
  LOOP AT ta_searchstrings INTO wa_search_str.
    CLEAR: tp_real_offset.
    tp_string_copy = tp_string.
    DO.
      FIND FIRST OCCURRENCE OF wa_search_str IN tp_string_copy RESULTS wa_result.
      IF sy-subrc &amp;lt;&amp;gt; 0.
        EXIT.
      ENDIF.
      tp_real_offset = tp_real_offset + wa_result-offset.
      MOVE: tp_real_offset   TO wa_result_out-offset,
            wa_search_str    TO wa_result_out-search_string,
            wa_result-length TO wa_result_out-length.
      APPEND wa_result_out TO ta_result_out.
      SPLIT tp_string_copy AT wa_search_str INTO tp_dummy tp_string_copy.
      CONCATENATE wa_search_str tp_string_copy INTO tp_string_copy.
      SHIFT tp_string_copy LEFT.
      tp_real_offset = tp_real_offset + 1.
    ENDDO.
  ENDLOOP.
ENDTRY.
SORT ta_result_out BY length search_string offset.
DELETE ADJACENT DUPLICATES FROM ta_result_out COMPARING search_string offset.
PERFORM alv_grid_display.
*--------------------------------------------------------------------*
FORM alv_grid_display.
*--------------------------------------------------------------------*
  CLEAR : rf_table.
  TRY.
      CALL METHOD cl_salv_table=&amp;gt;factory
        EXPORTING
          list_display = if_salv_c_bool_sap=&amp;gt;false
        IMPORTING
          r_salv_table = rf_table
        CHANGING
          t_table      = ta_result_out.
    CATCH cx_salv_msg .
  ENDTRY.
  IF rf_table IS INITIAL.
    MESSAGE 'Error Creating ALV Grid ' TYPE 'I' DISPLAY LIKE 'E'.
    STOP.
  ENDIF.
  rf_functions = rf_table-&amp;gt;get_functions( ).
  rf_functions-&amp;gt;set_all( if_salv_c_bool_sap=&amp;gt;true ).
  rf_functions-&amp;gt;set_view_lotus( ' ' ).
  rf_functions-&amp;gt;set_view_excel( ' ' ).
  rf_functions-&amp;gt;set_graphics( ' ' ).
  CLEAR: rf_display.
  MOVE:  tp_string TO tp_title.
  rf_display = rf_table-&amp;gt;get_display_settings( ).             
  rf_display-&amp;gt;set_striped_pattern( if_salv_c_bool_sap=&amp;gt;true ).  
  rf_display-&amp;gt;set_list_header( tp_title ).                 
  rf_columns = rf_table-&amp;gt;get_columns( ).
  IF rf_columns IS NOT INITIAL.
    TRY.
        rf_column ?= rf_columns-&amp;gt;get_column( 'SEARCH_STRING' ).
        CALL METHOD rf_column-&amp;gt;set_medium_text
          EXPORTING
            value = 'Searched for:'.
        CALL METHOD rf_column-&amp;gt;set_alignment
          EXPORTING
            value = if_salv_c_alignment=&amp;gt;right.
      CATCH cx_salv_not_found.
      CATCH cx_salv_existing.
      CATCH cx_salv_data_error.
    ENDTRY.
    TRY.
        rf_column ?= rf_columns-&amp;gt;get_column( 'OFFSET' ).
        CALL METHOD rf_column-&amp;gt;set_medium_text
          EXPORTING
            value = 'At offset:'.
      CATCH cx_salv_not_found.
      CATCH cx_salv_existing.
      CATCH cx_salv_data_error.
    ENDTRY.
    TRY.
        rf_column ?= rf_columns-&amp;gt;get_column( 'LENGTH' ).
        CALL METHOD rf_column-&amp;gt;set_medium_text
          EXPORTING
            value = 'Length:'.
      CATCH cx_salv_not_found.
      CATCH cx_salv_existing.
      CATCH cx_salv_data_error.
    ENDTRY.
    rf_columns-&amp;gt;set_optimize( if_salv_c_bool_sap=&amp;gt;true ).
    rf_columns-&amp;gt;set_key_fixation( if_salv_c_bool_sap=&amp;gt;true ).
  ENDIF.
  CALL METHOD rf_table-&amp;gt;display.
ENDFORM.&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 23 Dec 2011 09:35:21 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-12-23T09:35:21Z</dc:date>
    <item>
      <title>Pattern recognition in a given string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465266#M1650759</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have one problem in finding a repeated pattern in a given string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example: if the given string  lv_string = '345723345982343452343345'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can check the lv_string, which contains '345'  repeatedly in it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so, i want  a ABAP code to get list of all such type of patterns repeated in a given string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;Venky.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 11:31:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465266#M1650759</guid>
      <dc:creator>venkatesha_n</dc:creator>
      <dc:date>2011-12-21T11:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern recognition in a given string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465267#M1650760</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey  F1 ... Please help Venkatesa &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 11:38:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465267#M1650760</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2011-12-21T11:38:35Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern recognition in a given string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465268#M1650761</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Its not there in F1 Help......&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 11:42:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465268#M1650761</guid>
      <dc:creator>venkatesha_n</dc:creator>
      <dc:date>2011-12-21T11:42:12Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern recognition in a given string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465269#M1650762</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have to Find it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 11:50:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465269#M1650762</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-12-21T11:50:57Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern recognition in a given string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465270#M1650763</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;its not just CP / CA / NP / CO... etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And also am not talking about regular expressions which we normally do by using cl_abap_matcher or cl_abap_regex.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try to understand the problem first:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: you are given just a string and nothing else and  you will not be given any search key/ pattern to be found.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;we have to search the given string so that, what part of string is repeated again and again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this is enough to understand the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;Venky.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 11:57:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465270#M1650763</guid>
      <dc:creator>venkatesha_n</dc:creator>
      <dc:date>2011-12-21T11:57:06Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern recognition in a given string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465271#M1650764</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To be fair to the OP, the question is not trivial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I challenge everyone here to write code to detect a string with patterns repeated more than once in the string. The pattern can be anything and is not known at design time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hint: Regular expressions may be a key and normal ABAP pattern matching is not much use&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are some programming snippets on the Web, though not in ABAP but still may be useful&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/037047fc-5506-4656-ad27-dab9a6c501ee" target="test_blank"&gt;http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/037047fc-5506-4656-ad27-dab9a6c501ee&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Vishnu Tallapragada on Dec 21, 2011 1:01 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just realize, the OP and I posted together&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 11:59:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465271#M1650764</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-12-21T11:59:22Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern recognition in a given string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465272#M1650765</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;data: lv_string type string.
data: mcnt type i.
lv_string = '345723345982343452343345'.

find ALL OCCURRENCES OF '345' in lv_string MATCH COUNT mcnt.

write: / mcnt.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did i win cookies?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 12:06:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465272#M1650765</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-12-21T12:06:16Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern recognition in a given string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465273#M1650766</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Vishnu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code is readily available in F1 help &lt;STRONG&gt;FIND - pattern&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 12:06:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465273#M1650766</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2011-12-21T12:06:39Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern recognition in a given string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465274#M1650767</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Keshav and Maen - sorry but you still don't seem to get it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We don't know what the pattern is.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We want to detect a string with repeated patterns, the pattern we don't know in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It can be anything&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;345w2343234523&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Vishnudoesn'tlikeVishnu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 12:09:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465274#M1650767</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-12-21T12:09:24Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern recognition in a given string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465275#M1650768</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Maen Anachronos ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please try to understand the problem..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have already told that, you will be given just a big string like this  '345723345982343452343345'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And you have to find out what part of the string is repeated again and again in the given string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and if there are multiple such parts of the string, which are repeated in a given string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;all that repeated substrings should be the output...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Interesting?....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Venky.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 12:10:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465275#M1650768</guid>
      <dc:creator>venkatesha_n</dc:creator>
      <dc:date>2011-12-21T12:10:56Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern recognition in a given string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465276#M1650769</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Using the FIND statement it should be easy to program the stuff. Even if the serach string is not given.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 12:11:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465276#M1650769</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-12-21T12:11:40Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern recognition in a given string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465277#M1650770</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;dude just use all occurences you will find the solution&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FIND ALL OCCURRENCES OF '345' in lv_string MATCH COUNT var&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Cheers&lt;/P&gt;&lt;P&gt;  NZAB&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 12:12:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465277#M1650770</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-12-21T12:12:20Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern recognition in a given string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465278#M1650771</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ow but i do understand.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Point is: you need to be creative to use the FIND statement.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 12:12:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465278#M1650771</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-12-21T12:12:42Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern recognition in a given string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465279#M1650772</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Vishnu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See this example in documentation&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: patt       TYPE string VALUE `now`, 
      text       TYPE string, 
      result_tab TYPE match_result_tab. 

FIELD-SYMBOLS &amp;lt;match&amp;gt; LIKE LINE OF result_tab. 


FIND ALL OCCURRENCES OF patt IN 
     `Everybody knows this is nowhere` 
     RESULTS result_tab. 

LOOP AT result_tab ASSIGNING &amp;lt;match&amp;gt;. 
  WRITE: / &amp;lt;match&amp;gt;-offset, &amp;lt;match&amp;gt;-length. 
ENDLOOP. 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mods-Sorry for pasting the standard code, did just in case to demonstrate that Its as simple as that &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;@OP- No Points please&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 12:14:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465279#M1650772</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2011-12-21T12:14:14Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern recognition in a given string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465280#M1650773</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello NZAB,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please go through the problem properly....?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Venky.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 12:14:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465280#M1650773</guid>
      <dc:creator>venkatesha_n</dc:creator>
      <dc:date>2011-12-21T12:14:27Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern recognition in a given string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465281#M1650774</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;He doesn't know if it is 345 or Vishnu or Maen or Keshav, that can repeat in the string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;He just wants to know if a pattern (which can be anything) is repeating in a string, if so what is (are) those. Not an easy problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Keshav, he doesn't know if it is "now" that can repeat in his string. It can be "now" or "then" or "here" or "there", can be anything&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 12:15:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465281#M1650774</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-12-21T12:15:31Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern recognition in a given string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465282#M1650775</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;data: gv_string type string.
data: gv_length type i.
data: gv_offset type i.
data: gv_search type string.
data: mcnt type i.


gv_string = '345723345982343452343345'.
gv_length = strlen( gv_string ).

write: / gv_string.

gv_offset = 0.
do gv_length times.
  if gv_offset eq 0.
    gv_search = gv_string(1).
  else.
    concatenate gv_search gv_string+gv_offset(1) into gv_search.
  endif.

  find ALL OCCURRENCES OF gv_search in gv_string MATCH COUNT mcnt.
  write: /'Search for', gv_search, 'counted', mcnt.

  gv_offset = gv_offset + 1.

enddo.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now i expect a really big cake instead of a cookie.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 12:18:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465282#M1650775</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-12-21T12:18:07Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern recognition in a given string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465283#M1650776</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maen, I guess, it will work, but it is not very efficient.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 12:20:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465283#M1650776</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-12-21T12:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern recognition in a given string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465284#M1650777</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have provided that standard code...Did anybody look into it &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 12:21:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465284#M1650777</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2011-12-21T12:21:26Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern recognition in a given string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465285#M1650778</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hehe... and why not? It's not like he's going to search for repeating patterns in the holy bible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And the challenge was: write a piece of code to do it. &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 12:21:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pattern-recognition-in-a-given-string/m-p/8465285#M1650778</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-12-21T12:21:32Z</dc:date>
    </item>
  </channel>
</rss>

