<?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: a question on regular expression in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/a-question-on-regular-expression/m-p/919227#M362076</link>
    <description>&lt;P&gt;Thanks for the input.&lt;BR /&gt;&lt;BR /&gt;Do you mean two ' in "/^'\s*'$/" should not be allowed? I did have difficulty understand why there are ' ' in the code and the next line they have " ". In my mind, even the first one is correct, ''="" in most of the place, why there are two lines? what is the benefit to do repeat this process on resolve( footnote( _n_ ))?&lt;/P&gt;</description>
    <pubDate>Thu, 07 Mar 2024 03:27:31 GMT</pubDate>
    <dc:creator>stataq</dc:creator>
    <dc:date>2024-03-07T03:27:31Z</dc:date>
    <item>
      <title>a question on regular expression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/a-question-on-regular-expression/m-p/919118#M362034</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am new to&amp;nbsp;regular expression and feel lost when I try to understand the pattern that are described in this format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I see a follwoing codes&amp;nbsp; and could not understand what they means. Could anyone guide me on this?Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;footnote( _n_ ) ne " "&lt;BR /&gt;and prxmatch( "/^'\s*'$/" , strip( footnote( _n_ ))) = 0&lt;BR /&gt;and prxmatch( '/^"\s*"$/' , strip( footnote( _n_ ))) = 0&lt;BR /&gt;and resolve( footnote( _n_ )) ne " "&lt;BR /&gt;and prxmatch( "/^'\s*'$/" , strip( resolve( footnote( _n_ )))) = 0&lt;BR /&gt;and prxmatch( '/^"\s*"$/' , strip( resolve( footnote( _n_ )))) = 0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;what "prxmatch( "/^'\s*'$/" , strip( footnote( _n_ ))) = 0" mean?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;whether it is same as " prxmatch( '/^"\s*"$/' , strip( footnote( _n_ ))) = 0"?&lt;/P&gt;
&lt;P&gt;why we need "resolve( footnote( _n_ )) ne " "" and then repeat prxmatch process?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2024 14:56:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/a-question-on-regular-expression/m-p/919118#M362034</guid>
      <dc:creator>stataq</dc:creator>
      <dc:date>2024-03-06T14:56:11Z</dc:date>
    </item>
    <item>
      <title>Re: a question on regular expression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/a-question-on-regular-expression/m-p/919122#M362036</link>
      <description>&lt;P&gt;refer to the&amp;nbsp;documentation.&lt;A href="https://documentation.sas.com/doc/en/vdmmlcdc/8.1/ds2ref/p0m49np18q0pdxn1laab98pazajo.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/vdmmlcdc/8.1/ds2ref/p0m49np18q0pdxn1laab98pazajo.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;It will return 0 if no match is found.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2024 15:37:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/a-question-on-regular-expression/m-p/919122#M362036</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2024-03-06T15:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: a question on regular expression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/a-question-on-regular-expression/m-p/919128#M362039</link>
      <description>Only got "Page not found" with refence link. &lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Do you know what "/^'\s*'$/" means? Thanks.</description>
      <pubDate>Wed, 06 Mar 2024 15:31:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/a-question-on-regular-expression/m-p/919128#M362039</guid>
      <dc:creator>stataq</dc:creator>
      <dc:date>2024-03-06T15:31:14Z</dc:date>
    </item>
    <item>
      <title>Re: a question on regular expression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/a-question-on-regular-expression/m-p/919131#M362041</link>
      <description>Just search PRXMATCH in SAS documentation. There are also plenty of papers on prxmatch on lexjansen.com. ^ means the beginning of the string. \s is whitespace. $ is the end of the string. You really need to read the documentation to understand the PRXMATCH function. Every good programmer must look into the documentation for things they don’t know.&lt;BR /&gt;</description>
      <pubDate>Wed, 06 Mar 2024 15:33:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/a-question-on-regular-expression/m-p/919131#M362041</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2024-03-06T15:33:49Z</dc:date>
    </item>
    <item>
      <title>Re: a question on regular expression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/a-question-on-regular-expression/m-p/919135#M362043</link>
      <description>&lt;P&gt;I updated the link.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2024 15:37:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/a-question-on-regular-expression/m-p/919135#M362043</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2024-03-06T15:37:41Z</dc:date>
    </item>
    <item>
      <title>Re: a question on regular expression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/a-question-on-regular-expression/m-p/919136#M362044</link>
      <description>&lt;P&gt;&lt;A href="https://support.sas.com/resources/papers/proceedings20/5172-2020.pdf" target="_blank"&gt;https://support.sas.com/resources/papers/proceedings20/5172-2020.pdf&lt;/A&gt;&amp;nbsp;this paper will go over a lot of it.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2024 15:39:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/a-question-on-regular-expression/m-p/919136#M362044</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2024-03-06T15:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: a question on regular expression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/a-question-on-regular-expression/m-p/919226#M362075</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/448857"&gt;@stataq&lt;/a&gt;&amp;nbsp;This syntax doesn't look right to start with because of the quoting.&lt;/P&gt;
&lt;P&gt;SAS functions that start with prx.. like prxmatch() allow to use Perl Regular Expressions within SAS code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regular Expressions can be very powerful for working with text patterns.&lt;/P&gt;
&lt;P&gt;Learning the Perl Regular Expression syntax will take you a bit of time. Others already shared links with you to get into it.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2024 03:05:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/a-question-on-regular-expression/m-p/919226#M362075</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-03-07T03:05:58Z</dc:date>
    </item>
    <item>
      <title>Re: a question on regular expression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/a-question-on-regular-expression/m-p/919227#M362076</link>
      <description>&lt;P&gt;Thanks for the input.&lt;BR /&gt;&lt;BR /&gt;Do you mean two ' in "/^'\s*'$/" should not be allowed? I did have difficulty understand why there are ' ' in the code and the next line they have " ". In my mind, even the first one is correct, ''="" in most of the place, why there are two lines? what is the benefit to do repeat this process on resolve( footnote( _n_ ))?&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2024 03:27:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/a-question-on-regular-expression/m-p/919227#M362076</guid>
      <dc:creator>stataq</dc:creator>
      <dc:date>2024-03-07T03:27:31Z</dc:date>
    </item>
    <item>
      <title>Re: a question on regular expression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/a-question-on-regular-expression/m-p/919229#M362077</link>
      <description>&lt;P&gt;You need to pass the RegEx as a string to the SAS RegEx function. That's why you need the outer quotes. The can be single or double quotes.&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;"&lt;/FONT&gt;&lt;/STRONG&gt;/^'\s*'$/&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;"&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To not get into some complicated masking exercise the inner quotes must just be different from the outer quotes (if outer single then inner double and vise versa).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The inner quotes are now just part of the Regular Expression - which I assume is not what the developer intended to do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The RegEx is:&amp;nbsp;&lt;SPAN&gt;^'\s*'$&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;^ Beginning of string&lt;/P&gt;
&lt;P&gt;' the single quote character&lt;/P&gt;
&lt;P&gt;\s a non-printable character ,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;* zero, one or many occurrences of the previous character -&amp;gt; zero, one or many non-printable characters&lt;/P&gt;
&lt;P&gt;' the single quote character&lt;/P&gt;
&lt;P&gt;$ end of string&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Above RegEx will find a match if the source string only contains zero, one or multiple non-print characters that are embedded into single quotes. If there is any other character in the string then it won't be a match (because of ^'...'$).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Because SAS is padding character variables with blanks what's also really important is to use trim() or strip() around the source variable to search.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2024 04:31:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/a-question-on-regular-expression/m-p/919229#M362077</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-03-07T04:31:29Z</dc:date>
    </item>
  </channel>
</rss>

