<?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 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Regular-Expression/m-p/333783#M75281</link>
    <description>Hello,&lt;BR /&gt;&lt;BR /&gt;The search patterns contain slashes so the '#' are used in place of  the '/' as patterns delimiters. &lt;BR /&gt;It avoids having to protect the '/'.&lt;BR /&gt;'s' is the substitution operator.&lt;BR /&gt;So the first command, for instance, replaces several consecutive slashes by a unique slash in the DIR string.</description>
    <pubDate>Fri, 17 Feb 2017 14:29:52 GMT</pubDate>
    <dc:creator>gamotte</dc:creator>
    <dc:date>2017-02-17T14:29:52Z</dc:date>
    <item>
      <title>Regular Expression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Regular-Expression/m-p/333771#M75271</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can any body explaine below code (PRXCHANGE)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't understand why they are using '#' and 'S'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DIR=prxchange("s#/+#/#", -1, DIR);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DIR=prxchange("s#^(/project\d+/)#/projects/#", 1, cats(DIR));&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in Advance&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2017 13:36:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Regular-Expression/m-p/333771#M75271</guid>
      <dc:creator>RajasekharReddy</dc:creator>
      <dc:date>2017-02-17T13:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Regular-Expression/m-p/333783#M75281</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;The search patterns contain slashes so the '#' are used in place of  the '/' as patterns delimiters. &lt;BR /&gt;It avoids having to protect the '/'.&lt;BR /&gt;'s' is the substitution operator.&lt;BR /&gt;So the first command, for instance, replaces several consecutive slashes by a unique slash in the DIR string.</description>
      <pubDate>Fri, 17 Feb 2017 14:29:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Regular-Expression/m-p/333783#M75281</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2017-02-17T14:29:52Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Regular-Expression/m-p/333785#M75283</link>
      <description>&lt;P&gt;the 's' before the regular expression is referred to as a pattern-matching modifier, and denotes that the expression is a substition/replacement expression.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the '#' is just acting as a delimiter. &amp;nbsp;common delimiters are "/" or "#" or "{}" or "[]" typically&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;s#/+#/#

=

s/\/+/\//&lt;/PRE&gt;
&lt;P&gt;When you use # instead of / as the delimiter, you make a pattern matching expression that would normally use the default delimiter, like the example, simpler, since you don't have to escape it&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The patter above is simple:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;match the "/" character 1 or more times, as many as possible without encounter some other token and replace that match with a single "/"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;s#^(/project\d+/)#/projects/#

or

s#^/project\d+/#/projects/#

or 

s/^\/project\d+\//\/projects\//&lt;/PRE&gt;
&lt;P&gt;matches a string where, at the beginning is starts with "/project" followed by 1 or more numbers and ending with "/" such as "/project1234/" and changes it to "/projects/"&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2017 14:51:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Regular-Expression/m-p/333785#M75283</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2017-02-17T14:51:20Z</dc:date>
    </item>
  </channel>
</rss>

