<?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: ABAP Regular expressions in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-regular-expressions/m-p/7386558#M1544755</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Take a globalvariable and assignit all values and in if clause use CP to implement the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nabheet&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 25 Oct 2010 06:44:42 GMT</pubDate>
    <dc:creator>nabheetscn</dc:creator>
    <dc:date>2010-10-25T06:44:42Z</dc:date>
    <item>
      <title>ABAP Regular expressions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-regular-expressions/m-p/7386557#M1544754</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello ABAPers ,&lt;/P&gt;&lt;P&gt;I have to restrict my string to the char's mentioned below : &lt;/P&gt;&lt;P&gt;A to Z  &lt;/P&gt;&lt;P&gt;Ä Ö Ü  &lt;/P&gt;&lt;P&gt;a to z  &lt;/P&gt;&lt;P&gt;ä  ö  ü  &lt;/P&gt;&lt;P&gt;ß  0 to 9&lt;/P&gt;&lt;P&gt;! " § % &amp;amp; / ( ) = ' + * , ; . : -  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am using the following code to do tht but it doesn't work . Would appreciate any help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;gv_string = 'ab1@'.
gv_pattern = '[A-Za-z0-9!"§%&amp;amp;/()=+*,;.:-ß]*'.

TRY.
    CREATE OBJECT gx_regex
      EXPORTING
        pattern = gv_pattern.
  CATCH cx_sy_regex .
ENDTRY.


TRY.
    CREATE OBJECT gx_matcher
      EXPORTING
        regex = gx_regex
        text  = gv_string.
  CATCH cx_sy_matcher .
ENDTRY.
*gt_match_result2 = gx_matcher-&amp;gt;find_all( ).

match = gx_matcher-&amp;gt;match( ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks ,&lt;/P&gt;&lt;P&gt;Sri&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Matt on Oct 25, 2010 4:27 PM - added  tags&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Oct 2010 06:27:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-regular-expressions/m-p/7386557#M1544754</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-25T06:27:56Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Regular expressions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-regular-expressions/m-p/7386558#M1544755</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Take a globalvariable and assignit all values and in if clause use CP to implement the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nabheet&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Oct 2010 06:44:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-regular-expressions/m-p/7386558#M1544755</guid>
      <dc:creator>nabheetscn</dc:creator>
      <dc:date>2010-10-25T06:44:42Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Regular expressions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-regular-expressions/m-p/7386559#M1544756</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Srivijaya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  You should modify your pattern : since you want any character in the list provided, you should encapsulate it into brackets : &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;'[A-Za-z0-9!"§%&amp;amp;/()=+*,;.:-ß*]'&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But since you have more than one character, you should repeat it n times with a star (*) after it :&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;'[A-Za-z0-9!"§%&amp;amp;/()=+*,;.:-ß*]*'&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Last thing, '-' is a special character which means for an interval, so you have to escape it with a basckslash :&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;'[A-Za-z0-9!"§%&amp;amp;/()=+*,;.:-ß*]*'&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And in order to test this easily, you can directly use it like this : &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA : gv_string  TYPE string,
       gv_pattern TYPE string,
       match      TYPE flag.

gv_string  = 'ab1@'.
gv_pattern = '[A-Za-z0-9!"§%&amp;amp;/()=+*,;.:-ß*]*'.

TRY.
    CALL METHOD cl_abap_matcher=&amp;gt;matches
      EXPORTING
        pattern = gv_pattern
        text    = gv_string
      RECEIVING
        success = match.
  CATCH cx_sy_regex.
    WRITE : 'Unable to evaluate pattern.'.
    EXIT.
ENDTRY.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Samuel&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Oct 2010 13:20:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-regular-expressions/m-p/7386559#M1544756</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-25T13:20:30Z</dc:date>
    </item>
  </channel>
</rss>

