title: how to write a regular expression to match a small part of a repeating pattern?
body: <p>I have the following pattern to match :</p>
  <pre><code>(10,'more random stuff 21325','random stuff','2014-10-26 04:50:23','','uca-default-u-kn','page')
  </code></pre>
  <p>For some context, it's part of a larger file , which contains many similar patterns separated by commas :</p>
  <pre><code>(10,'more random stuff 21325','random stuff','2014-10-26 04:50:23','','uca-default-u-kn','page'),
  (11,'more random stuff 1nyny5','random stuff','2014-10-26 04:50:23','','uca-default-u-kn','subcat'),
  (14,'more random stuff 21dd5','random stuff','2014-10-26 04:50:23','','uca-default-u-kn','page')
  </code></pre>
  <p>my goal is to ditch all patterns ending with 'page' and to keep the rest. For that, I'm trying to use
  regular expressions to identify those patterns. Here is the one I come out with for now :</p>
  <pre><code>&quot;\(.*?,\'page\'\)&quot;
  </code></pre>
  <p>However, it's not working as expected.
  In the following python code, I use this regex, and replace every match with an empty string :</p>
  <pre><code>import re
  
  txt = &quot;(10,'Redirects_from_moves','*..2NN:,@2.FBHRP:D6ܽ�','2014-10-26 04:50:23','','uca-default-u-kn','page'),&quot;
  txt += &quot;(11,'Redirects_with_old_history','*..2NN:,@2.FBHRP:D6ܽ�','2010-08-26 22:38:36','','uca-default-u-kn','page'),&quot;
  txt += &quot;(12,'Unprintworthy_redirects','*..2NN:,@2.FBHRP:D6ܽ�','2010-08-26 22:38:36','','uca-default-u-kn','subcat'),&quot;
  txt += &quot;(13,'Anarchism','random_stuff','2020-01-23 13:27:44',' ','uca-default-u-kn','page'),&quot;
  txt += &quot;(14,'Anti-capitalism','random_stuff','2020-01-23 13:27:44','','uca-default-u-kn','subcat'),&quot;
  txt += &quot;(15,'Anti-fascism','*D*L.8:NB\r�','2020-01-23 13:27:44','','uca-default-u-kn','subcat'),&quot;
  txt += &quot;(16,'Articles_containing_French-language_text','*D*L.8:NB\r�','2020-01-23 13:27:44','','uca-default-u-kn','page'),&quot;
  txt += &quot;(17,'Articles_containing_French-language_text','*D*L.8:NB\r�','2020-01-23 13:27:44','','uca-default-u-kn','page')&quot;
  
  new_txt = re.sub(&quot;\(.*?,\'page\'\)&quot;, &quot;&quot;,txt)
  </code></pre>
  <p>I was expecting that new_text would contains all patterns ending with 'subcat', and remove all
  patterns ending with 'page', however, I obtain :</p>
  <p><code>new_txt = ,,,,</code></p>
  <p>What's happening here ? How can I change my regex to obtain the desired result ?</p>