更新时间:2023-02-17 22:56:54
如果您的工具使用的引擎是C#正则表达式引擎,那么您可以尝试以下表达式:
If the engine used by your tool is the C# regular expression engine, then you can try the following expression:
(?<!,\s*"(?:[^\\"]|\\")*)\s+(?!(?:[^\\"]|\\")*"\s*,)
替换为空字符串.
伙计们的答案假设报价是平衡的,并使用计数来确定空格是否是报价值的一部分.
The guys answers assumed the quotes are balanced and used counting to determine if the space is part of a quoted value or not.
我的表达式查找不属于引号值的所有空格.
My expression looks for all spaces that are not part of a quoted value.