Using C#, I need to prepare a search text for searching in a SQL Server database using the LIKE command by replacing all whitespace outside quotes with a % character. Exampl
Instead of using a RegEx, use a simple state machine - loop over each character, noting whether you are "in" or "out" of quotes and only replace spaces when you are in the "out" state.