through to stack-overflow questions but didn't get the proper answer. I need a separate Regex for before & after a matching string.
1) Find word After a specific phrase/word (this one working fine)
var regex = new Regex(@"(?:" + mytext + @"\s)(?<word>\b\S+\b)");
2) Find word Before a specific phrase/word (not working)
var regex = new Regex(@"(?:\S+\s)?\S*" + mytext + @"\b\S");
mytext="xyz"
Input="this is abc xyz defg"
output should be like that
1) for first,which is working
xyz defg2) second, which is not working
abc xyz
Find word After a specific phrase/word
var regex = new Regex(mytext + @"\s\w+");
Find word Before a specific phrase/word
var regex2 = new Regex(@"\w+\s" + mytext);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With