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.
This is my regex
(?:rahul[\s"'?.!:s()\{\}])
This is my test string
rahul hello rahul! vyas and rahul? and rahul. and rahul: and rahul and rahul( and rahul) and rahul{ rahul.shiv rahuls vyas rips rahul!!
This is the site I'm using to create the regex Regex Creator
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.
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.
Update -
Screenshot for above matches

Update 2 for Second regex demo

The third capture group is only matching 2 words instead of 5 words.