<?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 expression in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Perl-expression/m-p/370072#M65079</link>
    <description>&lt;P&gt;That is awesome tool! Thank you so much, Chris.&lt;/P&gt;</description>
    <pubDate>Fri, 23 Jun 2017 18:10:55 GMT</pubDate>
    <dc:creator>ybz12003</dc:creator>
    <dc:date>2017-06-23T18:10:55Z</dc:date>
    <item>
      <title>Perl expression</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Perl-expression/m-p/370042#M65075</link>
      <description>&lt;P&gt;Hello:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could someone explain what are (?&amp;lt;!\d) and&amp;nbsp; d{4}(?!\d) meaning in the following codes?&amp;nbsp; Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://analytics.ncsu.edu/sesug/2012/CT-03.pdf" target="_blank"&gt;http://analytics.ncsu.edu/sesug/2012/CT-03.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P align="left"&gt;data SSN ;&lt;/P&gt;&lt;P align="left"&gt;input SSN $20. ;&lt;/P&gt;&lt;P align="left"&gt;datalines ;&lt;/P&gt;&lt;P align="left"&gt;123-54-2280&lt;/P&gt;&lt;P align="left"&gt;#987-65-4321&lt;/P&gt;&lt;P align="left"&gt;S.S. 666-77-8888&lt;/P&gt;&lt;P align="left"&gt;246801357&lt;/P&gt;&lt;P align="left"&gt;soc # 133-77-2000&lt;/P&gt;&lt;P align="left"&gt;ssnum 888_22-7779&lt;/P&gt;&lt;P align="left"&gt;919-555-4689&lt;/P&gt;&lt;P align="left"&gt;call me 1800123456&lt;/P&gt;&lt;P align="left"&gt;;&lt;/P&gt;&lt;P align="left"&gt;run ;&lt;/P&gt;&lt;P align="left"&gt;proc sql feedback ;&lt;/P&gt;&lt;P align="left"&gt;select ssn&lt;/P&gt;&lt;P align="left"&gt;, prxchange( ‘s/(?&amp;lt;!\d)\d{3}[-_]?\d{2}[-_]?\d{4}(?!\d)/xxxxxxxxx/io’, -1, ssn)&lt;/P&gt;&lt;P align="left"&gt;as ssn2&lt;/P&gt;&lt;P align="left"&gt;from ssn&lt;/P&gt;&lt;P align="left"&gt;;&lt;/P&gt;&lt;P&gt;quit ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jun 2017 17:35:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Perl-expression/m-p/370042#M65075</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2017-06-23T17:35:08Z</dc:date>
    </item>
    <item>
      <title>Re: Perl expression</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Perl-expression/m-p/370052#M65076</link>
      <description>&lt;P&gt;Do you have &lt;STRONG&gt;any&lt;/STRONG&gt; of the SAS documentation available?&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jun 2017 17:57:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Perl-expression/m-p/370052#M65076</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-06-23T17:57:22Z</dc:date>
    </item>
    <item>
      <title>Re: Perl expression</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Perl-expression/m-p/370056#M65077</link>
      <description>&lt;P&gt;From the link I provide below, it states that&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P align="left"&gt;The negative look-behind &lt;FONT face="Verdana" size="2"&gt;(i.e. &lt;/FONT&gt;&lt;FONT face="CourierNew" size="2"&gt;(?&amp;lt;!\d) &lt;/FONT&gt;&lt;FONT face="Verdana" size="2"&gt;) and negative look-ahead assertions (i.e. &lt;/FONT&gt;&lt;FONT face="CourierNew" size="2"&gt;(?!\d) &lt;/FONT&gt;&lt;FONT face="Verdana" size="2"&gt;) are &lt;/FONT&gt;&lt;I&gt;&lt;FONT face="Verdana-Italic" size="2"&gt;non-capturing&lt;/FONT&gt;&lt;/I&gt;&lt;FONT face="Verdana" size="2"&gt;.&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT face="Verdana" size="2"&gt;However, I still don't get what the code means.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jun 2017 18:00:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Perl-expression/m-p/370056#M65077</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2017-06-23T18:00:58Z</dc:date>
    </item>
    <item>
      <title>Re: Perl expression</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Perl-expression/m-p/370061#M65078</link>
      <description>&lt;P&gt;Here's how you can find out. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Visit&amp;nbsp;&lt;A href="https://regex101.com" target="_blank"&gt;https://regex101.com&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Paste in the main expression:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(?&amp;lt;!\d)\d{3}[-_]?\d{2}[-_]?\d{4}(?!\d)&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See the&amp;nbsp;&lt;STRONG&gt;Explanation&lt;/STRONG&gt; field.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/9775iB1BA9463F4530FF6/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="regexexp.png" title="regexexp.png" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jun 2017 18:03:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Perl-expression/m-p/370061#M65078</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2017-06-23T18:03:12Z</dc:date>
    </item>
    <item>
      <title>Re: Perl expression</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Perl-expression/m-p/370072#M65079</link>
      <description>&lt;P&gt;That is awesome tool! Thank you so much, Chris.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jun 2017 18:10:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Perl-expression/m-p/370072#M65079</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2017-06-23T18:10:55Z</dc:date>
    </item>
    <item>
      <title>Re: Perl expression</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Perl-expression/m-p/370082#M65080</link>
      <description>&lt;P&gt;(&lt;U&gt;?&amp;lt;!&lt;/U&gt;\d) --negative look behind&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;(?!\d)&amp;nbsp;&lt;/FONT&gt;--negative lookahead&lt;/P&gt;
&lt;P&gt;This values are used to check whether a particular&amp;nbsp;characters are present along with other&amp;nbsp; characters and hence they are called as zero value assertions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;?&amp;lt; symbol indicates look behind, which is to check wether a particular value is there&amp;nbsp; in front of the value you are looking for&lt;/P&gt;
&lt;P&gt;! symbol represents not equal to AKA negative&lt;/P&gt;
&lt;P&gt;Let us use easier example. if you&amp;nbsp;values goathair, cowhair, cowsomething&amp;nbsp;and you want to find&amp;nbsp;value hair&lt;/P&gt;
&lt;P&gt;and also do not want to have goat infront of hair then you something like this &lt;FONT face="Courier New"&gt;&lt;SPAN class="regexnest1"&gt;(?&amp;lt;!goat&lt;/SPAN&gt;&lt;SPAN class="regexnest1"&gt;)hair&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN class="regexnest1"&gt;(?&amp;lt;!\d) indicates that you donot&amp;nbsp;want a digit(\d) in the front of your expression given&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN class="regexnest1"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;?! symbol indicates lookahead, which is to check wether a particular value is there&amp;nbsp; in&amp;nbsp;back of the value you are looking for&lt;/P&gt;
&lt;P&gt;! symbol represents not equal to AKA negative&lt;/P&gt;
&lt;P&gt;Let us&amp;nbsp;take an&amp;nbsp;easier example. if you want to find value of&amp;nbsp; hairyboy&amp;nbsp;goodboy hairykid and you want to find&amp;nbsp;variable with hair&lt;/P&gt;
&lt;P&gt;and also do not want to pick hairyboy but the value should have hairy infront then &amp;nbsp;you do something like this hairy(?!&lt;FONT face="Courier New"&gt;&lt;SPAN class="regexnest1"&gt;boy)&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN class="regexnest1"&gt;\d{4}(?!\d)&amp;nbsp; --- \d{4} means a digit repeated 4 times after value and there is no digit after&amp;nbsp;that.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN class="regexnest1"&gt;I tried my best to explain, please let me know if something is unclear, confusing or wrong&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jun 2017 18:22:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Perl-expression/m-p/370082#M65080</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2017-06-23T18:22:02Z</dc:date>
    </item>
    <item>
      <title>Re: Perl expression</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Perl-expression/m-p/370097#M65081</link>
      <description>&lt;P&gt;Thank you very much for your detail explaination, Kiranv_&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jun 2017 19:12:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Perl-expression/m-p/370097#M65081</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2017-06-23T19:12:16Z</dc:date>
    </item>
    <item>
      <title>Re: Perl expression</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Perl-expression/m-p/374277#M65284</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/37783"&gt;@kiranv_&lt;/a&gt;&amp;nbsp;can you explain this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;been*? is matching to "bee". However, been+? is matching to "been".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know *? matches previous elenment zero or more times. I thought been*? should match to "been".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Sun, 09 Jul 2017 15:41:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Perl-expression/m-p/374277#M65284</guid>
      <dc:creator>SAS_inquisitive</dc:creator>
      <dc:date>2017-07-09T15:41:49Z</dc:date>
    </item>
    <item>
      <title>Re: Perl expression</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Perl-expression/m-p/374340#M65287</link>
      <description>&lt;P&gt;? &amp;nbsp;has difference in meaning when it is infront of + and *&lt;/P&gt;
&lt;P&gt;+ and * are greedy. It can match condition as long as there is possibility&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;say the word is "&lt;SPAN&gt;beennnnnnnnnn" , &amp;nbsp;&lt;/SPAN&gt;if you say been+ (+ is 1 or more) then it can &amp;nbsp;match "beennnnnnnnnn"&lt;/P&gt;
&lt;P&gt;? infront of + and * makes it non greedy.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;+? and *? are non greedy. &amp;nbsp;Non greedy means the search stops one it fulfills the least condition. for +? it is one &amp;nbsp;and for *? it is zero)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;say the word is "&lt;/SPAN&gt;&lt;SPAN&gt;beennnnnnnnnn"&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;and if you instruct regex engine to find&amp;nbsp; been+? &amp;nbsp;then it will pick ups "been" (n is there only once . non greedy here means once it picks first n it stops)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;say the word is&amp;nbsp;is "beennnnnnnnnn"if you&amp;nbsp;instruct regex engine to find&amp;nbsp;been*? it picks up "bee"(n can be zero and it stops immediately as non greedy. non greedy here means it can stop without seeing it)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 00:51:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Perl-expression/m-p/374340#M65287</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2017-07-10T00:51:01Z</dc:date>
    </item>
    <item>
      <title>Re: Perl expression</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Perl-expression/m-p/374635#M65297</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/37783"&gt;@kiranv_&lt;/a&gt;&amp;nbsp;this makes sense. Thanks !&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 18:17:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Perl-expression/m-p/374635#M65297</guid>
      <dc:creator>SAS_inquisitive</dc:creator>
      <dc:date>2017-07-10T18:17:29Z</dc:date>
    </item>
  </channel>
</rss>

