regex to find all words after specific word?
<p>I have a string like below:</p>

<pre><code>Features:  -Includes hanging accessories.  -Artist: William-Adolphe Bouguereau.  -Made with 100pct cotton canvas.  -100pct Anti-shrink pine wood bars and Epson anti-fade ultra chrome inks.  -100pct Hand-made and inspected in the U.S.A.  -Orientation: Horizontal.  **Subject: -Figures/Nautical and beach.**  Gender: -Unisex/Both.  Size: -Mini 17'' and under/Small 18''-24''/Medium 25''-32''/Large 33''-40''/Oversized 41'' and above.  Style: -Fine art.  Color: -Blue.  Country of Manufacture: -United States.  Product Type: -Print of painting.  Region: -Europe.  Primary Art Material: -Canvas. Dimensions:  -8'' H x 12'' W x 0.75'' D: 0.72 lb.  -12'' H x 18'' W x 0.75'' D: 1.14 lbs.  -12'' H x 18'' W x 1.5'' D: 2.45 lbs.  -18'' H x 26'' W x 0.75'' D: 1.44 lbs.  Paintings Prints Tori White Wildon Photography Photos Posters Abstract Black D cor Designs Framed Hazelwood Hokku Home Landscape Oil Accent 075 12 15 18 26 40 60 8 D H W x 1 1017 1824 2532 holidays, christmas gift gifts for girls boys
</code></pre>

<p>I have to find the words after particular word.  </p>

<p>I want to extract the words after the word <code>"Subject"</code> in above example.</p>

<p>The output should be like below:</p>

<pre><code>Subject: -Figures/Nautical and beach.
</code></pre>

<p>I tried below regex:</p>

<pre><code>re.compile('(?&lt;=subject)(.{30}(?:\s|.))',re.I)
</code></pre>

<p>But there is not fixed number of words after subject keyword to specify so I can't specify exact number of words.</p>

<p>How do I stop at "peroid" or space.There is no specific stopping criterion.</p>

<p>Try:</p>

<pre><code>re.compile('Subject: [^*]+')
</code></pre>

<p><a href="http://pythex.org/?regex=Subject%3A%20%5B%5E%5C*%5D%2B&amp;test_string=Features%3A%20%20-Includes%20hanging%20accessories.%20%20-Artist%3A%20William-Adolphe%20Bouguereau.%20%20-Made%20with%20100pct%20cotton%20canvas.%20%20-100pct%20Anti-shrink%20pine%20wood%20bars%20and%20Epson%20anti-fade%20ultra%20chrome%20inks.%20%20-100pct%20Hand-made%20and%20inspected%20in%20the%20U.S.A.%20%20-Orientation%3A%20Horizontal.%20%20**Subject%3A%20-Figures%2FNautical%20and%20beach.**%20%20Gender%3A%20-Unisex%2FBoth.%20%20Size%3A%20-Mini%2017%27%27%20and%20under%2FSmall%2018%27%27-24%27%27%2FMedium%2025%27%27-32%27%27%2FLarge%2033%27%27-40%27%27%2FOversized%2041%27%27%20and%20above.%20%20Style%3A%20-Fine%20art.%20%20Color%3A%20-Blue.%20%20Country%20of%20Manufacture%3A%20-United%20States.%20%20Product%20Type%3A%20-Print%20of%20painting.%20%20Region%3A%20-Europe.%20%20Primary%20Art%20Material%3A%20-Canvas.%20Dimensions%3A%20%20-8%27%27%20H%20x%2012%27%27%20W%20x%200.75%27%27%20D%3A%200.72%20lb.%20%20-12%27%27%20H%20x%2018%27%27%20W%20x%200.75%27%27%20D%3A%201.14%20lbs.%20%20-12%27%27%20H%20x%2018%27%27%20W%20x%201.5%27%27%20D%3A%202.45%20lbs.%20%20-18%27%27%20H%20x%2026%27%27%20W%20x%200.75%27%27%20D%3A%201.44%20lbs.%20%20Paintings%20Prints%20Tori%20White%20Wildon%20Photography%20Photos%20Posters%20Abstract%20Black%20D%20cor%20Designs%20Framed%20Hazelwood%20Hokku%20Home%20Landscape%20Oil%20Accent%20075%2012%2015%2018%2026%2040%2060%208%20D%20H%20W%20x%201%201017%201824%202532%20holidays%2C%20christmas%20gift%20gifts%20for%20girls%20boys&amp;ignorecase=0&amp;multiline=0&amp;dotall=0&amp;verbose=0" rel="nofollow" title="Demo">Demo</a></p>

python regex python-3.x pattern-matching