Hi,
I ve got the following reg exp
(-[^\w+])|([\w+]-[\w+])
I want to use it to replace dashes with a whitespace
test -test should not be replaced
test - test should be replaced
test-test should be replaced
So only if test -test the dash should NOT be replaced.
Currently ([\w+]-[\w+]) is replacing the t's around the dash.
var specialCharsExcept = new Regex(@"([\w+]-[\w+])", RegexOptions.IgnoreCase);
if (string.IsNullOrEmpty(term))
return "";
return specialCharsExcept.Replace(term, " ");
Any help? Thanks in advance
PS: I am using C#.
Update
I'm trying to use your reg exp for the following case now.
some - test "some test" - everything within the quotes the expression should not be applied
Is this possible?