<?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 ? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/regex/m-p/3825483#M919970</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm on an ECC5 system at the moment so those classes don't exist... but that didn't stop me trying!... I used &lt;A href="http://www.solmetra.com/scripts/regex/index.php" target="test_blank"&gt;http://www.solmetra.com/scripts/regex/index.php&lt;/A&gt; to test various patterns out and this appeared to be close:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
"(\.0000\t?)|([0\t]+?)$"
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;with the various options generated calls like&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
preg_replace('"(\.0000\t?)|([0\t]+?)$"', '', '1.5500');
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;returned results like&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
string(4) "1.55"
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;... but this is the first time I've ever tried a RegEx so may have missed the point (give me ABAP any day!)...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 09 May 2008 06:47:17 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-05-09T06:47:17Z</dc:date>
    <item>
      <title>RegEx ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regex/m-p/3825480#M919967</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to remove trailing zeros in numbers.  Given the value is held in a decimal variable called "duration", how do I achieve the following when outputting to String:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
"Duration" value             Required Output
1.550                ---------&amp;gt;     1.55
1.5000              ---------&amp;gt;     1.5
2.0000              ---------&amp;gt;     2
0.0100              ---------&amp;gt;     0.01
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I am doing this for PHP scripting&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a®&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 May 2008 02:09:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regex/m-p/3825480#M919967</guid>
      <dc:creator>former_member194669</dc:creator>
      <dc:date>2008-05-09T02:09:14Z</dc:date>
    </item>
    <item>
      <title>Re: RegEx ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regex/m-p/3825481#M919968</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not 100% clear from the question if you wanted to do this with RegEx in PHP or just within ABAP... for the latter, there are probably several ways but this is the first that leapt to mind:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
report zlocal_jc_sdn_regex.

data:
  g_number              type p decimals 4.

start-of-selection.
*1.550 ---------&amp;gt; 1.55
  g_number = '1.550'.
  perform fix_it.

*1.5000 ---------&amp;gt; 1.5
  g_number = '1.5000'.
  perform fix_it.

*2.0000 ---------&amp;gt; 2
  g_number = '2.0000'.
  perform fix_it.

*0.0100 ---------&amp;gt; 0.01
  g_number = '0.01'.
  perform fix_it.

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  fix_it
*&amp;amp;---------------------------------------------------------------------*
form fix_it.

  data:
    l_char(20)          type c.

  write: g_number to l_char right-justified.
  shift l_char right deleting trailing '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0'.
  shift l_char right deleting trailing '.'. "for NNN.0000
  shift l_char left  deleting leading  space.

  write: / g_number, '---------&amp;gt;', l_char.

endform.                    "fix_it
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;which gives:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;                               
      1.5500           &amp;gt; 1.55  
      1.5000           &amp;gt; 1.5   
      2.0000           &amp;gt; 2     
      0.0100           &amp;gt; 0.01  
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 May 2008 03:00:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regex/m-p/3825481#M919968</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-09T03:00:27Z</dc:date>
    </item>
    <item>
      <title>Re: RegEx ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regex/m-p/3825482#M919969</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jonathan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your reply. I wanted to do this for PHP scripting. I use several RegEx expressions like s/0*(&lt;A href="https://community.sap.com/0-9"&gt;&lt;/A&gt;+)/$1/g   but nothing got the result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am use class CL_ABAP_REGEX &amp;amp; MATCHER for this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a®&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 May 2008 03:09:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regex/m-p/3825482#M919969</guid>
      <dc:creator>former_member194669</dc:creator>
      <dc:date>2008-05-09T03:09:43Z</dc:date>
    </item>
    <item>
      <title>Re: RegEx ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regex/m-p/3825483#M919970</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm on an ECC5 system at the moment so those classes don't exist... but that didn't stop me trying!... I used &lt;A href="http://www.solmetra.com/scripts/regex/index.php" target="test_blank"&gt;http://www.solmetra.com/scripts/regex/index.php&lt;/A&gt; to test various patterns out and this appeared to be close:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
"(\.0000\t?)|([0\t]+?)$"
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;with the various options generated calls like&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
preg_replace('"(\.0000\t?)|([0\t]+?)$"', '', '1.5500');
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;returned results like&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
string(4) "1.55"
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;... but this is the first time I've ever tried a RegEx so may have missed the point (give me ABAP any day!)...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 May 2008 06:47:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regex/m-p/3825483#M919970</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-09T06:47:17Z</dc:date>
    </item>
    <item>
      <title>Re: RegEx ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regex/m-p/3825484#M919971</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Jonathan,&lt;/P&gt;&lt;P&gt;The link you provided help me lot &lt;A href="http://www.solmetra.com/scripts/regex/index.php" target="test_blank"&gt;http://www.solmetra.com/scripts/regex/index.php&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is my RegEx&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
    move '(?:(.d*[1-9])|.)0*$' to p_regex.
    condense p_regex.
    create object regex
      exporting
        pattern     = p_regex
        ignore_case = ''.
* For REGEX match
    matcher = cl_abap_matcher=&amp;gt;create(
                   pattern     = p_regex
                   ignore_case = ' '
                   table       = i_files ).

    lt_result = matcher-&amp;gt;replace_all( ).
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regarding sub matches i am not worrying about that currently.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; a®&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 May 2008 14:08:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regex/m-p/3825484#M919971</guid>
      <dc:creator>former_member194669</dc:creator>
      <dc:date>2008-05-09T14:08:51Z</dc:date>
    </item>
  </channel>
</rss>

