<?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 Python to SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Regular-Expression-Python-to-SAS/m-p/471254#M120685</link>
    <description>&lt;P&gt;My python is basic, but as far as I know the syntax is:&lt;/P&gt;
&lt;P&gt;NEW_STR=re.replace(REGEX&lt;SPAN&gt;, REPLACEMENT , OLD_STR)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;1. You need the &lt;STRONG&gt;re. &lt;/STRONG&gt;call&amp;nbsp;(what's the value of&amp;nbsp;df['VALUE'] ?)&amp;nbsp; for the RegEx parser to be used&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2. You need 3 parameters &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;3. I don't see how numbers are allowed&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Regardless,&amp;nbsp;the regular expression here matches:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;- one lower case letter or comma or upper case letter&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;- followed by word characters (this includes&amp;nbsp;digits and underscore)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 18 Jun 2018 22:53:58 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2018-06-18T22:53:58Z</dc:date>
    <item>
      <title>Regular Expression Python to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Regular-Expression-Python-to-SAS/m-p/471244#M120684</link>
      <description>&lt;P&gt;I'm converting some code from Python to SAS and stuck at one point - regular expressions. Can someone confirm my assumption is correct please?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think this line:&lt;/P&gt;
&lt;P&gt;df['VALUE'] = df['VALUE'].replace(r'([a-z,A-Z])\w+',0)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Basically removes all character values and replaces it with 0?&lt;/P&gt;
&lt;P&gt;Is this interpretation correct?&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;I can't run the program on the file otherwise I'd test it by running each program and comparing the results.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jun 2018 21:54:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Regular-Expression-Python-to-SAS/m-p/471244#M120684</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-06-18T21:54:05Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expression Python to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Regular-Expression-Python-to-SAS/m-p/471254#M120685</link>
      <description>&lt;P&gt;My python is basic, but as far as I know the syntax is:&lt;/P&gt;
&lt;P&gt;NEW_STR=re.replace(REGEX&lt;SPAN&gt;, REPLACEMENT , OLD_STR)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;1. You need the &lt;STRONG&gt;re. &lt;/STRONG&gt;call&amp;nbsp;(what's the value of&amp;nbsp;df['VALUE'] ?)&amp;nbsp; for the RegEx parser to be used&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2. You need 3 parameters &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;3. I don't see how numbers are allowed&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Regardless,&amp;nbsp;the regular expression here matches:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;- one lower case letter or comma or upper case letter&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;- followed by word characters (this includes&amp;nbsp;digits and underscore)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jun 2018 22:53:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Regular-Expression-Python-to-SAS/m-p/471254#M120685</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-06-18T22:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expression Python to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Regular-Expression-Python-to-SAS/m-p/471258#M120687</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are these pandas dataframes?&amp;nbsp; If so I would do it like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;import re


...


df['VAL'] = df['VAL'].apply(lambda x: re.sub('[A-Z]+', '0', x, flags=re.I))&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jun 2018 23:01:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Regular-Expression-Python-to-SAS/m-p/471258#M120687</guid>
      <dc:creator>tomcmacdonald</dc:creator>
      <dc:date>2018-06-18T23:01:45Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expression Python to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Regular-Expression-Python-to-SAS/m-p/471272#M120688</link>
      <description>&lt;P&gt;It is panda's but I'm going in the opposite direction, from Pandas/Python to SAS code. The data is too big to be handled well in python.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jun 2018 00:28:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Regular-Expression-Python-to-SAS/m-p/471272#M120688</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-06-19T00:28:17Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expression Python to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Regular-Expression-Python-to-SAS/m-p/471296#M120694</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;If I read&amp;nbsp;this RegEx correctly then it needs at least two characters to match; the first character needs to be a letter, the 2nd to n can be alphanumeric or an underscore.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample;
  infile datalines truncover;
  input source $char10.;
  format target $char10.;
  target=prxchange('s/[a-z,A-Z]\w+/0/i',1,source);
  datalines;
Abc9xy
a
a9
   _a
   a_
   _a_
123_a
  123_ab
123a_
 a123a_
 X_123a_
 X_123a_ bb
123_abc de
;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Jun 2018 04:00:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Regular-Expression-Python-to-SAS/m-p/471296#M120694</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-06-19T04:00:31Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expression Python to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Regular-Expression-Python-to-SAS/m-p/471297#M120695</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;gt;&amp;nbsp;&lt;SPAN&gt;If I read&amp;nbsp;this RegEx correctly then it needs at least two characters to match; the first character needs to be a letter, the 2nd to n can be alphanumeric or an underscore.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You mean: &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If I read&amp;nbsp;this RegEx correctly then it needs at least two characters to match; the first character needs to be a letter&lt;STRONG&gt; or a comma&lt;/STRONG&gt;, the 2nd one can be alphanumeric or an underscore.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jun 2018 04:04:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Regular-Expression-Python-to-SAS/m-p/471297#M120695</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-06-19T04:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expression Python to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Regular-Expression-Python-to-SAS/m-p/471298#M120696</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;True, missed the comma.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jun 2018 04:06:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Regular-Expression-Python-to-SAS/m-p/471298#M120696</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-06-19T04:06:22Z</dc:date>
    </item>
  </channel>
</rss>

