<?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: Regular Expression Help in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expression-help/m-p/4250280#M1014522</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;replace all gives &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
1|10|Johnson|"Stores and Sales"|High|10031984|paycycle1|"red|blue|green"|full
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;not &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
1|10|Johnson|"Stores and sales"|High|10031984|paycycle1|"red,blue,green"|full
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Aug 2008 08:17:13 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-08-07T08:17:13Z</dc:date>
    <item>
      <title>Regular Expression Help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expression-help/m-p/4250278#M1014520</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can anyone help me with a regular expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to replace all delimiting commas in a CSV string with another character. The string contents look something like this...&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;1,10,Johnson,"Stores and Sales",High,10031984,paycycle1,"red,blue,green",full&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;...so what I want to change it to is this...&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;1|10|Johnson|"Stores and Sales"|High|10031984|paycycle1|"red,blue,green"|full&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My problem is with the regex syntax. The closest I have got to is...&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;,(?![^"]*")&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;..but this produces the result...&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;1,10,Johnson,"Stores and Sales",High,10031984,paycycle1,"red,blue,green"|full&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;...as it only matches the commas after the last " delimited field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Graham Robbo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Aug 2008 07:56:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expression-help/m-p/4250278#M1014520</guid>
      <dc:creator>GrahamRobbo</dc:creator>
      <dc:date>2008-08-07T07:56:02Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expression Help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expression-help/m-p/4250279#M1014521</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;Use&lt;/P&gt;&lt;P&gt; REPLACE ALL OCCURANCES OF ',' IN &amp;lt;variable&amp;gt; WITH '|' IN CHARACTER MODE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mohaiyuddin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Aug 2008 08:01:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expression-help/m-p/4250279#M1014521</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-07T08:01:24Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expression Help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expression-help/m-p/4250280#M1014522</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;replace all gives &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
1|10|Johnson|"Stores and Sales"|High|10031984|paycycle1|"red|blue|green"|full
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;not &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
1|10|Johnson|"Stores and sales"|High|10031984|paycycle1|"red,blue,green"|full
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Aug 2008 08:17:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expression-help/m-p/4250280#M1014522</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-07T08:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expression Help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expression-help/m-p/4250281#M1014523</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, I missed that part.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe some logic can help.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

data : var_overlay(1000) type c.
data : var1(1000) type c,
         l_total_len type i,
         l_count type i,
         l_index type i,
         l_remainder type i

var1 = &amp;lt;your string&amp;gt;.

l_total_len = strlen( var1 ).

clear l_index.
clear l_count.
clear var_overlay.

do l_total_len times.
l_index = sy-index - 1.
if var1+l_index(1) = '"'.
l_count = l_count + 1.
endif.

l_remainder = l_count MOD 2.
if l_remainter = 1. " start of pattern
var_overlay+l_index(1) = var1+l_index(1).
else. " end of pattern
endif.

enddo.

REPLACE ALL OCCURANCES OF ',' in var1 with '|' RESULTS var1.

OVERLAY var_overlay WITH var1.

*var_overlay will contain your desired result.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mohaiyuddin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Aug 2008 09:37:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expression-help/m-p/4250281#M1014523</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-07T09:37:29Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expression Help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expression-help/m-p/4250282#M1014524</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data:char(125) .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;char = '1,10,Johnson,"Stores and Sales",High,10031984,paycycle1,"red,blue,green",full'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       replace all occurrences of ',' in char with '/' .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     write: char.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Aug 2008 09:48:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expression-help/m-p/4250282#M1014524</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-07T09:48:19Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expression Help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expression-help/m-p/4250283#M1014525</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your contributions, but my question is regarding "[Regular Expressions|http://en.wikipedia.org/wiki/Regular_expressions]" not string handling.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If anyone can help me with a [regular expression|http://help.sap.com/saphelp_erp2005/helpdata/en/42/9d6ceabb211d73e10000000a1553f6/content.htm] to achieve the desired result I would appreciate it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Graham Robbo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Aug 2008 23:58:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expression-help/m-p/4250283#M1014525</guid>
      <dc:creator>GrahamRobbo</dc:creator>
      <dc:date>2008-08-07T23:58:34Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expression Help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expression-help/m-p/4250284#M1014526</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No solution provided. Closing thread.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Sep 2008 03:47:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expression-help/m-p/4250284#M1014526</guid>
      <dc:creator>GrahamRobbo</dc:creator>
      <dc:date>2008-09-03T03:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expression Help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expression-help/m-p/4250285#M1014527</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Graham,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You may need to employ 3 steps to accomplish your goal:&lt;/P&gt;&lt;P&gt;1. Break up the string into fields using the regex&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;&lt;SPAN lang=""&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;(([^,]+)|([\s]*"([^"]|"[^,])*")),?&lt;/P&gt;&lt;P&gt;for example&lt;/P&gt;&lt;P&gt;FIND ALL OCCURRENCES OF REGEX regexp IN string RESULTS lt_result.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800080; font-size: 10pt;"&gt;2. Replace last comma in each field with '|'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800080; font-size: 10pt;"&gt;REPLACE FIRST OCCURRENCE OF REGEX '(?:,)$' IN field WITH '|'.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800080; font-size: 10pt;"&gt;3. Concatenate the fields back into one string&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Imad&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Sep 2014 17:01:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regular-expression-help/m-p/4250285#M1014527</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-09-16T17:01:46Z</dc:date>
    </item>
  </channel>
</rss>

