<?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: Perl regular expression for matching comments in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Perl-regular-expression-for-matching-comments/m-p/329040#M73554</link>
    <description>&lt;P&gt;Hello RW9. I'm calculating CTC grades for laboratory results, and so the algorithms along with the comments are within my variables. I'm using&amp;nbsp;this alongside call execute.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've seen a potential solution on this site, which goes over the things you have mentioned, i.e comments on multiple lines. I'm just trying to incorportate this into SAS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://blog.ostermiller.org/find-comment" target="_blank"&gt;http://blog.ostermiller.org/find-comment&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks,&lt;/P&gt;</description>
    <pubDate>Wed, 01 Feb 2017 11:16:14 GMT</pubDate>
    <dc:creator>djrisks</dc:creator>
    <dc:date>2017-02-01T11:16:14Z</dc:date>
    <item>
      <title>Perl regular expression for matching comments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Perl-regular-expression-for-matching-comments/m-p/329029#M73551</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to know the regular expression I can use to match comments please? Such as /* This is a comment */&lt;/P&gt;&lt;P&gt;I would like to replace the comment with just this text "/* */" in order to save space within my variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the code that I've been trying to use, just to see if I can match the opening of the comments tag, but I'm not sure how to do it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;without_comments&amp;nbsp;= prxchange("s//\*\w+)/ /", -1, with_comments);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;You're help will be greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kriss&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 10:38:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Perl-regular-expression-for-matching-comments/m-p/329029#M73551</guid>
      <dc:creator>djrisks</dc:creator>
      <dc:date>2017-02-01T10:38:48Z</dc:date>
    </item>
    <item>
      <title>Re: Perl regular expression for matching comments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Perl-regular-expression-for-matching-comments/m-p/329038#M73553</link>
      <description>&lt;P&gt;Sorry, what do you mean by:&lt;/P&gt;
&lt;P&gt;"&lt;SPAN&gt;I would like to replace the comment with just this text "/* */" in order to save space within my variable.&lt;/SPAN&gt;"&lt;/P&gt;
&lt;P&gt;Comments are not in a variable, they are in code. &amp;nbsp;Are you storing code in a dataset or something, why?&lt;/P&gt;
&lt;P&gt;As for replacing it, comment could be anything. &amp;nbsp;Comes down to code parsing which isn't a simple matter. &amp;nbsp;// is also a comment, /* could go over mutiple line. &amp;nbsp;Various other things to bear in mind also. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 11:07:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Perl-regular-expression-for-matching-comments/m-p/329038#M73553</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-02-01T11:07:07Z</dc:date>
    </item>
    <item>
      <title>Re: Perl regular expression for matching comments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Perl-regular-expression-for-matching-comments/m-p/329040#M73554</link>
      <description>&lt;P&gt;Hello RW9. I'm calculating CTC grades for laboratory results, and so the algorithms along with the comments are within my variables. I'm using&amp;nbsp;this alongside call execute.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've seen a potential solution on this site, which goes over the things you have mentioned, i.e comments on multiple lines. I'm just trying to incorportate this into SAS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://blog.ostermiller.org/find-comment" target="_blank"&gt;http://blog.ostermiller.org/find-comment&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks,&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 11:16:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Perl-regular-expression-for-matching-comments/m-p/329040#M73554</guid>
      <dc:creator>djrisks</dc:creator>
      <dc:date>2017-02-01T11:16:14Z</dc:date>
    </item>
    <item>
      <title>Re: Perl regular expression for matching comments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Perl-regular-expression-for-matching-comments/m-p/329045#M73557</link>
      <description>&lt;P&gt;I've seen that this code can be used to match comments. Which is similar to what that website had. I just had to escape the forward slashes too. For my example, I can just use this simple case below. Because it does find the majority of my comments (if not all). I think when the results are in the dataset there may not be the issue of comments being on multiple lines.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;pattern = prxparse("/\/\*.*\*\//");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for you help.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 11:48:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Perl-regular-expression-for-matching-comments/m-p/329045#M73557</guid>
      <dc:creator>djrisks</dc:creator>
      <dc:date>2017-02-01T11:48:11Z</dc:date>
    </item>
  </channel>
</rss>

