title: regex to extract 5 words after the match
body: <p>I'm trying to create a regex in my app and having trouble understanding it. I've created one regex but still, I want it to be modified to do not match specific things. I need to create regex for both iOS and Android.</p>
  <p>This is my regex</p>
  <pre><code>(?:rahul[\s&quot;'?.!:s()\{\}])
  </code></pre>
  <p>This is my test string</p>
  <pre><code>rahul hello rahul! vyas and rahul? and rahul. and rahul: and rahul and rahul( and rahul) and rahul{ rahul.shiv  rahuls vyas rips rahul!!
  </code></pre>
  <p>This is the site I'm using to create the regex
  <a href="https://regex101.com/r/1FQ8eq/1/" rel="nofollow noreferrer">Regex Creator</a></p>
  <p>What I actually want to match is if user type word rahul then it should match all rahul words including punctuations or if the word has s in it in the end. It should not select rahul.shiv.</p>
  <p>Also is it possible to extract 5 words after the match and before the match. lets assume the word is in the middle of the sentence and I need to extract 5 words as prefix of the match and 5 words as suffix of the match. If anyone knows how to create this regex kindly answer the question with explanation.</p>
  <p>Update -
  Screenshot for above matches
  <a href="https://i.stack.imgur.com/bCxwM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bCxwM.png" alt="enter image description here" /></a></p>
  <p>Update 2 for Second regex demo
  <a href="https://i.stack.imgur.com/TR3No.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TR3No.png" alt="enter image description here" /></a></p>
  <p>The third capture group is only matching 2 words instead of 5 words.</p>