<?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 %sysfunc(prxmatch()) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/sysfunc-prxmatch/m-p/74181#M15998</link>
    <description>Hi,&lt;BR /&gt;
I was coding a macro and I decided to cut corners and use PRX on it.&lt;BR /&gt;
But I found one detail that I could not understand (mind that i'm a newbie when it gets to macros and macro quoting :p).&lt;BR /&gt;
&lt;BR /&gt;
My question is this:&lt;BR /&gt;
why is that the folowing statements don't work or give incorrect results:&lt;BR /&gt;
%put %sysfunc(prxmatch(/\d/,123));&lt;BR /&gt;
%put %sysfunc(prxmatch('/\d/',123));&lt;BR /&gt;
%put %sysfunc(prxmatch(%nrbquote(/\d/),123));&lt;BR /&gt;
%put %sysfunc(prxmatch(%nrbquote('/\d/'),123));&lt;BR /&gt;
&lt;BR /&gt;
the only way I got it to work was:&lt;BR /&gt;
%put %sysfunc(prxmatch(%nrbquote('\d'),123));&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Can anyone explain this to me??&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thanks in advance&lt;BR /&gt;
Pedro Glória</description>
    <pubDate>Wed, 07 Apr 2010 18:38:49 GMT</pubDate>
    <dc:creator>Pgloria</dc:creator>
    <dc:date>2010-04-07T18:38:49Z</dc:date>
    <item>
      <title>%sysfunc(prxmatch())</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sysfunc-prxmatch/m-p/74181#M15998</link>
      <description>Hi,&lt;BR /&gt;
I was coding a macro and I decided to cut corners and use PRX on it.&lt;BR /&gt;
But I found one detail that I could not understand (mind that i'm a newbie when it gets to macros and macro quoting :p).&lt;BR /&gt;
&lt;BR /&gt;
My question is this:&lt;BR /&gt;
why is that the folowing statements don't work or give incorrect results:&lt;BR /&gt;
%put %sysfunc(prxmatch(/\d/,123));&lt;BR /&gt;
%put %sysfunc(prxmatch('/\d/',123));&lt;BR /&gt;
%put %sysfunc(prxmatch(%nrbquote(/\d/),123));&lt;BR /&gt;
%put %sysfunc(prxmatch(%nrbquote('/\d/'),123));&lt;BR /&gt;
&lt;BR /&gt;
the only way I got it to work was:&lt;BR /&gt;
%put %sysfunc(prxmatch(%nrbquote('\d'),123));&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Can anyone explain this to me??&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thanks in advance&lt;BR /&gt;
Pedro Glória</description>
      <pubDate>Wed, 07 Apr 2010 18:38:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sysfunc-prxmatch/m-p/74181#M15998</guid>
      <dc:creator>Pgloria</dc:creator>
      <dc:date>2010-04-07T18:38:49Z</dc:date>
    </item>
    <item>
      <title>Re: %sysfunc(prxmatch())</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sysfunc-prxmatch/m-p/74182#M15999</link>
      <description>How about a reply to explain in non-PRX language-speak, what it is you want to accomplish?  Suggest a BEFORE and AFTER data-string, if you would -- there may be other options to you, not involving PRX.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Wed, 07 Apr 2010 19:07:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sysfunc-prxmatch/m-p/74182#M15999</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-04-07T19:07:05Z</dc:date>
    </item>
    <item>
      <title>Re: %sysfunc(prxmatch())</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sysfunc-prxmatch/m-p/74183#M16000</link>
      <description>These examples are just a reduction of my problem, on those examples I want each line to output 1 to the log.&lt;BR /&gt;
 &lt;BR /&gt;
I just realy want to understand the reason for me not getting to use the slash '/' on the regex when I use the PRX functions inside a %sysfunc.&lt;BR /&gt;
&lt;BR /&gt;
On the last of my examples I got it working, so it's just to kill my curiosity.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thanks &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;</description>
      <pubDate>Wed, 07 Apr 2010 21:24:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sysfunc-prxmatch/m-p/74183#M16000</guid>
      <dc:creator>Pgloria</dc:creator>
      <dc:date>2010-04-07T21:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: %sysfunc(prxmatch())</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sysfunc-prxmatch/m-p/74184#M16001</link>
      <description>Found the problem,&lt;BR /&gt;
The prxmatch function has 2 versions one that gets a regular-expression-id and the other a perl-regular-expression has the firt parameter.&lt;BR /&gt;
&lt;BR /&gt;
SAS checks the first char in the string, and if it is a number or a aritmetic operator it %evals() the parameter.&lt;BR /&gt;
&lt;BR /&gt;
So, doing:&lt;BR /&gt;
%let regex_id=%sysfunc(prxparse(/\d/));&lt;BR /&gt;
%put %sysfunc(prxmatch(&amp;amp;regex_id,123));&lt;BR /&gt;
&lt;BR /&gt;
Works like a charm &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;</description>
      <pubDate>Thu, 08 Apr 2010 09:57:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sysfunc-prxmatch/m-p/74184#M16001</guid>
      <dc:creator>Pgloria</dc:creator>
      <dc:date>2010-04-08T09:57:33Z</dc:date>
    </item>
  </channel>
</rss>

