<?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: Help in finding a regex pattern in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-finding-a-regex-pattern/m-p/8614217#M1663366</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;I am in 4.6 version and dont have the facility to regex it for you.&lt;/P&gt;&lt;P&gt;Just wrote a sample code, if useful then use it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA:lv_string(100) TYPE c.
DATA:lv_len TYPE i.
TYPES:BEGIN OF ty,
      field(100) TYPE c,
      END OF ty.
DATA:it TYPE TABLE OF ty.
FIELD-SYMBOLS:&amp;lt;fs&amp;gt; TYPE ty.
lv_string = '132, 143, "222, 144, abc", 227, 888, "222#55#ab"'.
CONDENSE lv_string NO-GAPS.
SPLIT lv_string AT '"' INTO TABLE it.
CLEAR lv_string.
LOOP AT it ASSIGNING &amp;lt;fs&amp;gt;.
  IF &amp;lt;fs&amp;gt; IS INITIAL.
    delete it index sy-tabix.
    CONTINUE.
  ENDIF.
  lv_len = strlen( &amp;lt;fs&amp;gt; ) - 1.
  IF ( &amp;lt;fs&amp;gt;+lv_len(1) CA '"' ) OR ( &amp;lt;fs&amp;gt;+lv_len(1) CA ',' ).
    &amp;lt;fs&amp;gt;+lv_len(1) = ' '.
  ENDIF.
  IF ( &amp;lt;fs&amp;gt;+0(1) CA '"' ) OR ( &amp;lt;fs&amp;gt;+0(1) CA ',' ).
    &amp;lt;fs&amp;gt;+0(1) = ' '.
  ENDIF.
  CONDENSE &amp;lt;fs&amp;gt;.
  WRITE:/ &amp;lt;fs&amp;gt;.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 24 Feb 2012 11:48:10 GMT</pubDate>
    <dc:creator>kesavadas_thekkillath</dc:creator>
    <dc:date>2012-02-24T11:48:10Z</dc:date>
    <item>
      <title>Help in finding a regex pattern</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-finding-a-regex-pattern/m-p/8614213#M1663362</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear all REGEX Gurus.  &lt;/P&gt;&lt;P&gt;We have a comma separated string like this: &lt;/P&gt;&lt;P&gt;132, 143, "222, 144, abc", 227, 888, "222#55#ab"&lt;/P&gt;&lt;P&gt;As you might have guessed, this comes from excel when we save as CSV file, and when one of the columns in excel has the value 222,144,abc. So excel itself puts " at beginning and end. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now we want to split it based on ',' like this: &lt;/P&gt;&lt;P&gt;132&lt;/P&gt;&lt;P&gt;143&lt;/P&gt;&lt;P&gt;222,144,abc&lt;/P&gt;&lt;P&gt;227&lt;/P&gt;&lt;P&gt;888&lt;/P&gt;&lt;P&gt;222#55#ab&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So what we thought is to use a REGEX to find a pattern that has anything beginning with ", ending with ", and has a comma (,) in between. We'd replace that comma with a special character. &lt;/P&gt;&lt;P&gt;System seems to perform greedy search if i search like this "&lt;STRONG&gt;,&lt;/STRONG&gt;". &lt;/P&gt;&lt;P&gt;I tried this: &lt;/P&gt;&lt;P&gt;"([^"]+)" -&amp;gt; this works that it gives me all values within quotes. But I want only those which have a comma in them. &lt;/P&gt;&lt;P&gt;So in above, i do not want 222#55#ab to come. &lt;/P&gt;&lt;P&gt;Tried various combinations, but not able to get it work. &lt;/P&gt;&lt;P&gt;Can someone advise please how to achieve it? &lt;/P&gt;&lt;P&gt;Thanks in adv.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Feb 2012 09:40:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-finding-a-regex-pattern/m-p/8614213#M1663362</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-02-24T09:40:34Z</dc:date>
    </item>
    <item>
      <title>Re: Help in finding a regex pattern</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-finding-a-regex-pattern/m-p/8614214#M1663363</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;my first idea:&lt;/P&gt;&lt;P&gt;SPLIT line AT ',' INTO TABLE xyz&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT XYZ&lt;/P&gt;&lt;P&gt;and when you find a "' at first position -&amp;gt; concatenate with the following lines until you find a " at the end.&lt;/P&gt;&lt;P&gt;ENDLOOP&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Feb 2012 10:05:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-finding-a-regex-pattern/m-p/8614214#M1663363</guid>
      <dc:creator>former_member226519</dc:creator>
      <dc:date>2012-02-24T10:05:23Z</dc:date>
    </item>
    <item>
      <title>Re: Help in finding a regex pattern</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-finding-a-regex-pattern/m-p/8614215#M1663364</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, we already tried that. &lt;/P&gt;&lt;P&gt;It has a problem that if there is an opening ", but no closing ", then our search becomes useless. &lt;/P&gt;&lt;P&gt;Moreover it slows down performance as our data can have many rows. &lt;/P&gt;&lt;P&gt;Hence I thought REGEX would be a faster and simpler way.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Feb 2012 10:19:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-finding-a-regex-pattern/m-p/8614215#M1663364</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-02-24T10:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: Help in finding a regex pattern</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-finding-a-regex-pattern/m-p/8614216#M1663365</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;If &lt;STRONG&gt;" "&lt;/STRONG&gt;  will give atleast one &lt;STRONG&gt;,&lt;/STRONG&gt; then give &lt;STRONG&gt;regex&lt;/STRONG&gt; with + .&lt;/P&gt;&lt;P&gt;Well i didn tried it. Just give a try.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please check the use of +(page 4)  in [this link|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/03a52be5-0901-0010-9da4-e9d5f8c5ce1c?QuickLink=index&amp;amp;overridelayout=true].&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Feb 2012 10:42:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-finding-a-regex-pattern/m-p/8614216#M1663365</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-02-24T10:42:15Z</dc:date>
    </item>
    <item>
      <title>Re: Help in finding a regex pattern</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-finding-a-regex-pattern/m-p/8614217#M1663366</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;I am in 4.6 version and dont have the facility to regex it for you.&lt;/P&gt;&lt;P&gt;Just wrote a sample code, if useful then use it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA:lv_string(100) TYPE c.
DATA:lv_len TYPE i.
TYPES:BEGIN OF ty,
      field(100) TYPE c,
      END OF ty.
DATA:it TYPE TABLE OF ty.
FIELD-SYMBOLS:&amp;lt;fs&amp;gt; TYPE ty.
lv_string = '132, 143, "222, 144, abc", 227, 888, "222#55#ab"'.
CONDENSE lv_string NO-GAPS.
SPLIT lv_string AT '"' INTO TABLE it.
CLEAR lv_string.
LOOP AT it ASSIGNING &amp;lt;fs&amp;gt;.
  IF &amp;lt;fs&amp;gt; IS INITIAL.
    delete it index sy-tabix.
    CONTINUE.
  ENDIF.
  lv_len = strlen( &amp;lt;fs&amp;gt; ) - 1.
  IF ( &amp;lt;fs&amp;gt;+lv_len(1) CA '"' ) OR ( &amp;lt;fs&amp;gt;+lv_len(1) CA ',' ).
    &amp;lt;fs&amp;gt;+lv_len(1) = ' '.
  ENDIF.
  IF ( &amp;lt;fs&amp;gt;+0(1) CA '"' ) OR ( &amp;lt;fs&amp;gt;+0(1) CA ',' ).
    &amp;lt;fs&amp;gt;+0(1) = ' '.
  ENDIF.
  CONDENSE &amp;lt;fs&amp;gt;.
  WRITE:/ &amp;lt;fs&amp;gt;.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Feb 2012 11:48:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-finding-a-regex-pattern/m-p/8614217#M1663366</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2012-02-24T11:48:10Z</dc:date>
    </item>
    <item>
      <title>Re: Help in finding a regex pattern</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-finding-a-regex-pattern/m-p/8614218#M1663367</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Keshav and everyone else. &lt;/P&gt;&lt;P&gt;But I was really looking for a REGEX to achieve the same task as I feel a good REGEX will be much faster than all this logic. &lt;/P&gt;&lt;P&gt;I have currently also written a logic to overcome this problem, but earlier I have used REGEX to find file names and extensions and I feel it is very powerful and wonderful. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any advices on what regex can make it work for me here? Thanks again in adv &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Mar 2012 01:37:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-finding-a-regex-pattern/m-p/8614218#M1663367</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-03-01T01:37:11Z</dc:date>
    </item>
  </channel>
</rss>

