Is there a way that the Regex will check the first and the last character, but will replace only the IV
and not the spaces.
Regex.Replace("This is IV item.", "[^A-Za-z0-9](IV)[^A-Za-z0-9]", "fourth");
Please don't tell me about MatchEvaluator and other Match based things, I need a one line solution, and one line doesn't mean combining code, it means using Replace method only.
Also I am not talking only about spaces, I am talking in general for any character, like: (
Once again, let me clear, I am not looking for anything other than some regex symbols that will match the characters but won't replace it and not this method:
Regex.Replace("This is IV item.", "([^A-Za-z0-9])(IV)([^A-Za-z0-9])", "$1fourth$3");
as this regex are parameters to some code that will automatically automatically uses $1 for some thing and I don't want to change that code, so is there a way so that $1 will be IV
only, while checking that the previous character also.