<?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: regular expression (prxparse) question in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/regular-expression-prxparse-question/m-p/480013#M124012</link>
    <description>&lt;P&gt;something like below. here ^ means starting position where we have x1 as requirement. &lt;FONT size="3"&gt;&lt;STRONG&gt;.+&lt;/STRONG&gt; &lt;/FONT&gt;indicates any character after the starting position and ? stops reading&amp;nbsp; once it find any&amp;nbsp; other character mentioned in regex. &amp;nbsp;$ means at the last position and here we have y2 as per requirement&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;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; DATA want;  
    IF _N_ = 1 THEN PATTERN_NUM = PRXPARSE("/^x1.+?y2$/");  
 
RETAIN PATTERN_NUM; 
    INPUT STRING $30.;    if PRXMATCH(PATTERN_NUM,trim(STRING))= 1 then output; 
	drop pattern_num;
DATALINES; 
x1abc_efy2
x12y2
x1a!y2
x2abcy2
x1zy3
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 20 Jul 2018 18:35:31 GMT</pubDate>
    <dc:creator>kiranv_</dc:creator>
    <dc:date>2018-07-20T18:35:31Z</dc:date>
    <item>
      <title>regular expression (prxparse) question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/regular-expression-prxparse-question/m-p/479988#M124000</link>
      <description>&lt;P&gt;How would I create a regular expression using prxparse that always starts with x1, ends with y2 and the middle part can be any length (1+) and any characters?&lt;/P&gt;&lt;P&gt;For example, I want:&lt;/P&gt;&lt;P&gt;x1abc_efy2&lt;/P&gt;&lt;P&gt;x12y2&lt;/P&gt;&lt;P&gt;x1a!y2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't want:&lt;/P&gt;&lt;P&gt;x2abcy2&lt;/P&gt;&lt;P&gt;x1zy3&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;</description>
      <pubDate>Fri, 20 Jul 2018 17:47:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/regular-expression-prxparse-question/m-p/479988#M124000</guid>
      <dc:creator>gzr2mz39</dc:creator>
      <dc:date>2018-07-20T17:47:16Z</dc:date>
    </item>
    <item>
      <title>Re: regular expression (prxparse) question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/regular-expression-prxparse-question/m-p/480013#M124012</link>
      <description>&lt;P&gt;something like below. here ^ means starting position where we have x1 as requirement. &lt;FONT size="3"&gt;&lt;STRONG&gt;.+&lt;/STRONG&gt; &lt;/FONT&gt;indicates any character after the starting position and ? stops reading&amp;nbsp; once it find any&amp;nbsp; other character mentioned in regex. &amp;nbsp;$ means at the last position and here we have y2 as per requirement&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;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; DATA want;  
    IF _N_ = 1 THEN PATTERN_NUM = PRXPARSE("/^x1.+?y2$/");  
 
RETAIN PATTERN_NUM; 
    INPUT STRING $30.;    if PRXMATCH(PATTERN_NUM,trim(STRING))= 1 then output; 
	drop pattern_num;
DATALINES; 
x1abc_efy2
x12y2
x1a!y2
x2abcy2
x1zy3
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Jul 2018 18:35:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/regular-expression-prxparse-question/m-p/480013#M124012</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2018-07-20T18:35:31Z</dc:date>
    </item>
    <item>
      <title>Re: regular expression (prxparse) question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/regular-expression-prxparse-question/m-p/480016#M124014</link>
      <description>&lt;P&gt;Looks like the parsing guys are on vacation today.&amp;nbsp; If it would help, here's a way to do it without parsing:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;x1 = index(var, 'x1');&lt;/P&gt;
&lt;P&gt;y2 = index(var, 'y2');&lt;/P&gt;
&lt;P&gt;if y2 &amp;gt; x1 &amp;gt; 0 then newvar = substr(var, x1, y2 - x1 + 2);&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2018 18:37:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/regular-expression-prxparse-question/m-p/480016#M124014</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-07-20T18:37:20Z</dc:date>
    </item>
  </channel>
</rss>

