<?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: Subtract string using regular expression in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Extract-string-using-regular-expression/m-p/619704#M19425</link>
    <description>&lt;P&gt;Try prxChange:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;want = prxChange("/.*ex\D*(\d+\D\d*).*/\1/", 1, have);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 23 Jan 2020 22:48:25 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2020-01-23T22:48:25Z</dc:date>
    <item>
      <title>Extract string using regular expression</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Extract-string-using-regular-expression/m-p/619703#M19424</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to use SAS regular expression to extract a substring from some messy strings.&amp;nbsp; I've compiled regular expression patterns but not quite sure how to do that in SAS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The examples are as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Have&lt;/TD&gt;&lt;TD&gt;Want&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;a2191625zex-10_14.htm&lt;/TD&gt;&lt;TD&gt;10_14&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ade4378dexhibit10_2.txt&lt;/TD&gt;&lt;TD&gt;10_2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The regular expression I come up with is&amp;nbsp;(ex\D*)(\d+\D+\d*)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using two sets of brackets here to group.&amp;nbsp; In Python or other languages, I can locate what I want by identify group(2).&amp;nbsp; Is there any similar function here in SAS?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would be very grateful if someone can help out here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Dara&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jan 2020 15:19:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Extract-string-using-regular-expression/m-p/619703#M19424</guid>
      <dc:creator>daradanye</dc:creator>
      <dc:date>2020-01-24T15:19:19Z</dc:date>
    </item>
    <item>
      <title>Re: Subtract string using regular expression</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Extract-string-using-regular-expression/m-p/619704#M19425</link>
      <description>&lt;P&gt;Try prxChange:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;want = prxChange("/.*ex\D*(\d+\D\d*).*/\1/", 1, have);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Jan 2020 22:48:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Extract-string-using-regular-expression/m-p/619704#M19425</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2020-01-23T22:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: Extract string using regular expression</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Extract-string-using-regular-expression/m-p/619981#M19477</link>
      <description>&lt;PRE&gt;data x;
input have : $40. ;
pid=prxparse('/[\d_]+(?=\.[a-z]+)/io');
if pid&amp;gt;0 then do;
call prxsubstr(pid,have,p,l);
want=substr(have,p,l);
end;
cards;
a2191625zex-10_14.htm
ade4378dexhibit10_2.txt
;
proc print;run;&lt;/PRE&gt;</description>
      <pubDate>Sat, 25 Jan 2020 09:13:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Extract-string-using-regular-expression/m-p/619981#M19477</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-01-25T09:13:53Z</dc:date>
    </item>
    <item>
      <title>Re: Extract string using regular expression</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Extract-string-using-regular-expression/m-p/619982#M19478</link>
      <description>&lt;P&gt;OR this Scan():&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data x;
input have : $40. ;
want=scan(scan(have,1,'.'),-1,'_','kd');
cards;
a2191625zex-10_14.htm
ade4378dexhibit10_2.txt
;
proc print;run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 25 Jan 2020 09:15:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Extract-string-using-regular-expression/m-p/619982#M19478</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-01-25T09:15:39Z</dc:date>
    </item>
  </channel>
</rss>

